簡體   English   中英

如何添加Wordpress模板的打開和關閉簡碼?

[英]How to add a Wordpress template opening and closing shortcode?

最近,我安裝了wordpress Themeforest VideoTube主題。 但是,當我使用codecanyon Social Locker插件時,就會遇到此問題。 我的WordPress主題僅支持do_shortcode

我的短代碼是...

[sociallocker id="2378"]    [/sociallocker]

我想將此代碼放在我的短代碼的中間位置。

<div class="player player-small <?php print apply_filters( 'aspect_ratio' , 'embed-responsive embed-responsive-16by9');?>">

請幫助我...我該怎么做? 我在wordpress主題functions.php文件中設置了什么查詢?

您可以像這樣使用do_shortcode,

$text_to_be_wrapped_in_shortcode = '<div class="player player-small <?php print apply_filters( 'aspect_ratio' , 'embed-responsive embed-responsive-16by9');?>">';

echo do_shortcode( '[sociallocker id="2378"]' . $text_to_be_wrapped_in_shortcode . '[/sociallocker]' );

這應該工作,

$text_to_be_wrapped = "<div class='player player-small ".apply_filters( 'aspect_ratio' , 'embed-responsive embed-responsive-16by9')."'";

echo do_shortcode( '[sociallocker id="2378"]' . $text_to_be_wrapped . '[/sociallocker]' );

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM