adsense

How to Put WordPress Shortcode Into PHP





1. Log in to your WordPress dashboard and navigate to 'Appearance.' Click the 'Editor' link under 'Appearance' to load the 'Edit Themes' screen. Look under the 'Templates' heading on the 'Edit Themes' screen to find the template file in which you want to embed the shortcode. You can embed the shortcode in 'index.php' to add it to your blog index or put it in 'single.php' to add it to your single post pages. Add shortcodes to 'page.php' to add them to pages.
2. Click the link for the file to load it in the editing box. Locate the portion of the code where you want to place the shortcode, using the class and ID names of the
tags as your guide. You can place the shortcode inside or outside the WordPress 'loop.'

3. Open a pair of PHP tags and write code to output the results of the 'do_shortcode()' function. Pass the shortcode into 'do_shortcode()' as a parameter, typing it out as a string. This is how it should look:
Use single quotes around the shortcode so you can type out a shortcode with an attribute containing double quotes, like this:

Comments

0 Responses to "How to Put WordPress Shortcode Into PHP"

Post a Comment

Popular Posts

About