简体   繁体   中英

How to add a Wordpress template opening and closing shortcode?

recently i install wordpress Themeforest VideoTube Theme. But when i use codecanyon Social Locker plugin, then facing this issue. My wordpress theme only support do_shortcode

My short code is...

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

and i want to put this code in the middle position of my short code.

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

Kindly help me... how can i to do this? What query i set to in my wordpress theme functions.php file?

You can use do_shortcode like this way,

$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]' );

This should work,

$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]' );

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM