Using Shortcodes in themes
-
I’m using the ProPlayer plugin, that uses a shortcode [pro-player]value[/pro-player]
I would like to show the most recent video in the sidebar. So my plan is to use a ‘video’ custom field and put the video posts in a videos category. Then I can display the video custom field of the first post in the videos category. Which will be the most recent video…
But I’ve run into a wall due to the shortcode. From what I’ve read, there are certainly ways to use shortcodes in themes, but everything I do just outputs the normal bracketed text.
Here’s the something that I’ve tried:
<?php // if there's a video if($video !== '') { ?> <?php echo do_shortcode('[pro-player]$video[/pro-player]'); ?> <?php } // end if statement // if there's not a thumbnail else { echo ''; } ?>
Which ouputs
[pro-player]$video[/pro-player]
I’ve also tried
<?php // if there's a video if($video !== '') { ?> <?php echo do_shortcode("[pro-player]'$video'[/pro-player]"); ?> <?php } // end if statement // if there's not a thumbnail else { echo ''; } ?>
Which shows
[pro-player]’https://www.youtube.com/watch?v=UF8Cs2gqXfk'%5B/pro-player%5D
What ever that means…
Any help would be greatly appreciated. Thanks
- The topic ‘Using Shortcodes in themes’ is closed to new replies.