How to use short code in wordpress page template
Shortcodes are becoming more and more popular in WordPress, for a good reason. They make it very easy to invoike some kind of function or script to accomplish certain tasks. For example, video embedding in WP 2.9+ uses the [video] [/video] shortcode. Lots of advertising managers allow the use of short code, to place ads right in a post or page. You can also write your own shortcodes, and plugins often offer their functionality via shortcodes as well.

For instance in my article “How to make a custom home page layout in any wordpress theme without programming” I discus how to use a plugin that lets you place a widget area anywhere you want in a post or page using a shortcode. Well, you can also accomplish the same result if you wanted to easily ad a widget area to a custom page template. This is the technique I used to get the custom layout you see on this blog!

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 this special function:

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

Good luck with your current project, I hope this was helpful for you.

Tagged with:

Filed under: How To

Like this post? Subscribe to my RSS feed and get loads more!