How to Use Shortcodes in your WordPress Theme Files

Got a plugin that does something really nifty, and turns out really good results in your WordPress posts and pages? Want to use that shortcode in your theme files, somewhere, outside the loop, and not sure how to do that?

This WordPress tutorial will tell you how to get this done.

Thankfully, as with so many things WordPress, the solution here is oh so simple, and involves just the pasting of the following code, with your intended shortcode replaced, wherever you would like it to appear in your theme (great for hard-wiring shortcodes into ALL posts, for example):

Code Example – adding shortcode into PHP theme files



Got questions?

Any questions, comments or problems, or just want to say “thank you, that worked!” – leave a public comment, below.

A little about Silicon Dales

This type of code is the sort of thing we use routinely, here at Silicon Dales, on behalf of our maintenance and management clients to keep their websites looking beautiful and working as they wish.

Leave a comment

No links of any kind allowed in comments - if you add any links, your comment will automatically be deleted.