Justin Tadlock

Template Tag Shortcodes: WordPress Plugin

Template Tags Shortcodes

What I’ve always thought would be a neat plugin would be something that gave users the ability to insert WordPress template tags from within the Write Post/Page screen. I’ve also gotten a few requests for this type of functionality.

Template Tag Shortcodes comes loaded with 40 shortcodes that represent their equivalent template tags.

For example, a commonly used template tag is wp_list_pages(). But, it’s a PHP function and can’t be used within the post editor (without a PHP plugin). With this plugin, you could simply type in [wp_list_pages] and let the plugin do all the work.

The available shortcodes

If you know me, you know I can’t stop at one or two shortcodes. That’s why I made 40.

Several shortcodes have additional parameters, which are listed in the plugin’s readme.html file. Here’s the list of what’s currently available in the plugin.

  • [wp_list_authors]
  • [the_author]
  • [the_author_description]
  • [the_author_login]
  • [the_author_firstname]
  • [the_author_lastname]
  • [the_author_nickname]
  • [the_author_ID]
  • [the_author_url]
  • [the_author_email]
  • [the_author_link]
  • [the_author_aim]
  • [the_author_yim]
  • [the_author_posts]
  • [the_author_posts_link]
  • [the_modified_author]
  • [wp_list_categories]
  • [wp_dropdown_categories]
  • [the_category]
  • [get_category_link]
  • [the_date]
  • [the_time]
  • [the_modified_date]
  • [the_modified_time]
  • [wp_tag_cloud]
  • [the_tags]
  • [get_tag_link]
  • [wp_list_bookmarks]
  • [the_title]
  • [the_title_attribute]
  • [the_ID]
  • [the_permalink]
  • [get_permalink]
  • [wp_list_pages]
  • [wp_dropdown_pages]
  • [wp_get_archives]
  • [bloginfo]
  • [allowed_tags]
  • [wp_logout_url]
  • [wp_login_url]
  • [comments_link]
  • [category_description]
  • [tag_description]
  • [term_description]
  • [the_terms]
  • [the_author_meta]

I’m sure more will be added over time. If you have a particular template tag you’d like to see as a shortcode, just let me know in the comments.

Some important notes

These shortcodes don’t provide additional XHTML formatting. For example, [wp_list_pages] won’t be wrapped with the <ul> tag. This is because its equivalent template tag wp_list_pages() does not do this. So, you’ll want to add any additional formatting from within the post editor.

I struggled with this decision but thought it was the best route. The goal was to adhere to the same rules as the WordPress template tags.

Download the Template Tag Shortcodes plugin

Get the plugin. Enjoy. Let me know how it works out for you. For full instructions, see the readme.html file included with the plugin download.

Please don’t use my contact page or the comments section below to ask support questions. Use my support forums at Theme Hybrid, which is where I handle all support questions for my WordPress projects.

If you run across any bugs or want to share ideas about how to make this plugin better, feel free to post in the comments below.