i want to add social locker on custom fields like demo and download buttons
<center><p><a class="mbutton" target="_blank" href="<?php echo get_field(demo_link); ?>">DEMO</a><p></center>
<center><p><a class="dbutton" target="_blank" href="<?php echo get_field(download_link); ?>">DOWNLOAD</a><p></center>
i tried to use <?php echo do_shortcode("[lockercat]"); ?> added here buttons <?php echo do_shortcode("[/lockercat]"); ?>
..... with this locker works now but get_field function doesnt work and getting link like this
example/post-name/php echo get_field(download_link); ?>
....
<?php
$lockit = '[lockercat]' . '<center><p><a class="mbutton" target="_blank" href="<?php echo get_field(demo_link); ?>">DEMO</a><p></center>
<center><p><a class="dbutton" target="_blank" href="<?php echo get_field(download_link); ?>">DOWNLOAD</a><p></center>' . '[/lockercat]';
echo do_shortcode($lockit);
?>
i want to add social locker on custom fields like demo and download buttons
<center><p><a class="mbutton" target="_blank" href="<?php echo get_field(demo_link); ?>">DEMO</a><p></center>
<center><p><a class="dbutton" target="_blank" href="<?php echo get_field(download_link); ?>">DOWNLOAD</a><p></center>
i tried to use <?php echo do_shortcode("[lockercat]"); ?> added here buttons <?php echo do_shortcode("[/lockercat]"); ?>
..... with this locker works now but get_field function doesnt work and getting link like this
example/post-name/php echo get_field(download_link); ?>
....
<?php
$lockit = '[lockercat]' . '<center><p><a class="mbutton" target="_blank" href="<?php echo get_field(demo_link); ?>">DEMO</a><p></center>
<center><p><a class="dbutton" target="_blank" href="<?php echo get_field(download_link); ?>">DOWNLOAD</a><p></center>' . '[/lockercat]';
echo do_shortcode($lockit);
?>
Share
Improve this question
edited Mar 26, 2018 at 20:50
Lashh a
asked Mar 26, 2018 at 19:44
Lashh aLashh a
112 bronze badges
1
|
1 Answer
Reset to default 1The do_shortcode()
syntax requires everything in one string.
<?php
$lockit = '[lockercat]' . 'your buttons etc.' . '[/lockercat]';
echo do_shortcode($lockit);
?>
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744649321a4585804.html
[shortcode
] in one call, then[/shortcode]
in another – Tom J Nowell ♦ Commented Mar 26, 2018 at 20:09