Tip: use shortcodes anywhere

| October 15, 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.

Related Posts

Tags: , , , , ,

Leave a Reply