So Easy Even a Chimp Can Do It!
RSS icon Email icon Bullet (black)
  • WordPress Short Codes in Templates

    Posted on December 1st, 2009 steve 1 comment

    How do you put shortcodes in your template files?

    I came across a problem the other day.  I found a plugin I wanted to use but it didn’t have any php calls to invoke it, only WordPress shortcodes.  I scanned the forums and found a very good alternative from Dukessa.  By using a WordPress call to the short code  I could add the call to the header.php file.

    Here is the call format:

    <?php echo do_shortcode(’[shortcode]‘); ?>

    Here is an example of how to embed a short code in a header.php file for NextGEN Gallery plugin.

    <?php echo do_shortcode(’[slideshow id=1]‘); ?>

    Give it a try, it works great.

    Post to Twitter Post to Plurk Plurk This Post Post to Digg Digg This Post Post to Ping.fm Ping This Post Post to StumbleUpon Stumble This Post

     

    One Response to “WordPress Short Codes in Templates”

    1. You’ve done it again! Incredible article!

    Leave a Reply

Bad Behavior has blocked 264 access attempts in the last 7 days.

Twitter links powered by Tweet This v1.6.1, a WordPress plugin for Twitter.