Posted By

cwulff on 10/31/10


template wordpress shortcode

Versions (?)

Who likes this?

3 people have marked this snippet as a favorite


WordPress Shortcode in a Template

 / Published in: PHP

From CSS-Tricks: Shortcodes in WordPress are bits of text you can use in the content area to invoke some kind of function to accomplish certain tasks. For example, video embedding in WP 2.9+ uses the [video] [/video] shortcode. You can write your own shortcodes, and plugins often offer their functionality via shortcodes as well.

But what if you want to use a shortcode from within a template instead of with the content of a Post/Page? You can invoke it with a special function:

  1. <?php echo do_shortcode("[shortcode]"); ?>

Report this snippet  

You need to login to post a comment.