Get FAST WordPress Support
World’s Fastest WordPress Support Since 2009  
Go Up  VIEW SERVICES  
Use WordPress Shortcodes Inside Of Your Php Files

Use WordPress Shortcodes Inside of Your PHP Files

The Shortcode-API can help to make your Editor more advance especially with the help of Shortcodes to insert external content to your posts or pages easily. There are many possibilities, an at the bottom of this post there is a list of plugins that you can instal to add shortcodes to your theme if they do not already have them.

But if sometimes you like to use a Shortcode in your Template or just don’t like to put it in the Editor, for example you like to insert it in the Custom Field or somewhere else. There is a function in WordPress which helps you to insert a shortcode somewhere else besides your Editor.

The easiest way to ru na short code directly inside one of your theme PHP files is to copy the code below, change out where it says “my_shortcode” with the shortcode name and place it where you would like the shortcode to display

<?php echo do_shortcode('[my_shortcode]');?>

CLICK HERE FOR A FULL LIST OF SHORTCODE PLUGINS

Leave a Reply

Your email address will not be published. Required fields are marked *

QUESTIONS