DISCLAIMER: this post is older than one year and may not be up to date with latest WordPress version.

WordPress shortcode are extremely useful, but many people thinks you can’t use them outside of the editor, for example in your theme files. But you can, and it’s pretty easy. Just read this recipe to know how to do.

Simply use the do_shortcode() function anywhere in your theme file. The shortcode you want to use have to be given to the function as shown below:

<?php do_shortcode('[gallery]'); ?>

That’s all 🙂

Recipe initially published on CatsWhoCode.

2 Comments

  1. Did the same and searched the web extensively. For whatever reasons the new 3.5 version of WordPress does not allow shortcodes outside the content area.
    Trying to get a 3.o version Google map to appear on all my pages of one theme. It is dynamically updated with the address of the business on the page to get the location. This one is the comprehensive Google map, not theirs, which runs in an iFrame and requires both some key and a lot of programming to make work. It is done in the newer 3.o Google map format it says.

  2. I am using plugin like to read http://wordpress.org/extend/plugins/like-to-keep-reading/
    problem is its using opening and closing shortcodes,when I embed them to my site http://vijaykudal.info only opening short codes displayed,can you please help me?

    PS:-tried with different themes as well

Leave a Comment

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