Tip: use shortcodes anywhere

March 11, 2010 | Leave a Comment

Shortcodes are meant to be used for post and page content, but with a little custom code you can make them work elsewhere, as shown in this article:

  • Text Widgets
  • Template Files
  • Comments
  • Excerpts
  • User Descriptions
  • Category, Tag, and Taxonomy Descriptions

I think the most crucial piece of code to remember here is the one for theme files. Just add the line do_shortcode('[foo]'); and that will obey shortcode syntax. Super convenient! Also check out this list of custom shortcodes. For WordPress.com users, there are a bunch of media shortcodes already built in.

See also: how to use widgets anywhere.

Share This Blog Post

  • email
  • Twitter
  • Tumblr
  • FriendFeed
  • Facebook
  • Digg
  • del.icio.us
  • Blogosphere News
  • StumbleUpon
  • Google Bookmarks
  • Ping.fm
  • HelloTxt
  • Mixx

Related Posts

Tags: , , , , ,

Leave a Reply

CommentLuv Enabled
Download WordPress
WordPress Philippines
  • China Wholesale