A guide to Template Tag Shortcodes

Template Tag Shortcodes is a plugin that turns many of the WordPress template tags into easy-to-use shortcodes.

This plugin was created so end users could make use of the template tags within their posts and pages. Currently, this plugin creates 40+ shortcodes for use. Not all template tags are available as shortcodes, but you are more than welcome to request others be added.

How to install the plugin

  1. Unzip the template-tag-shortcodes.zip folder.
  2. Upload the template-tag-shortcodes folder to your /wp-content/plugins directory.
  3. In your WordPress dashboard, head over to the Plugins section.
  4. Activate Template Tag Shortcodes.

How to use the plugin

Once you've activated the plugin, you'll want to type one or more of the shortcodes within your post/page. Here is a basic example of the [wp_list_pages] shortcode:

[wp_list_pages]

That will create a list of all your pages. But, you can do much more. Most shortcodes have several arguments you can input. Here's an example of [wp_list_pages] that only lists specific pages we want:

[wp_list_pages include="1,2,3,4"]

If you're giving this a go, you might notice the invalid XHTML output. This is because the shortcode does not wrap <ul> tags around the list items. This is the default WordPress functionality that several template tags have. This plugin will adhere to the WP defaults. So, we might want to make this valid:

<ul>[wp_list_pages include="1,2,3,4"]</ul>

This is both a burden and a blessing. It forces you to input the appropriate XHTML with a few of the shortcodes (particularly the ones that list items). However, it gives you much more flexibility. For example, we could've wrapped the list in <ol> tags.

The Shortcodes

I'm not going to explain each shortcode's parameters here. That would take hours of my time. Quite frankly, I don't have that much time to give. I encourage you to be familiar with the template tag equivalent of the shortcode you'd like to use. I will link to the relevant template tags below.

I've separated each shortcode into groups for easier referencing. Just click on a link below to find particular shortcodes:

Author Shortcodes

[wp_list_authors]
Template Tag: wp_list_authors()
Parameters: optioncount, exclude_admin, show_fullname, hide_empty, feed, feed_image, style, html
[the_author_meta]
Template Tag: the_author_meta()
Parameters: field, user_id
[the_author]
Template Tag: the_author()
This shortcode has no parameters.
[the_author_description]
Template Tag: the_author_description()
This shortcode has no parameters.
[the_author_login]
Template Tag: the_author_login()
This shortcode has no parameters.
[the_author_firstname]
Template Tag: the_author_firstname()
This shortcode has no parameters.
[the_author_lastname]
Template Tag: the_author_lastname()
This shortcode has no parameters.
[the_author_nickname]
Template Tag: the_author_nickname()
This shortcode has no parameters.
[the_author_ID]
Template Tag: the_author_ID()
This shortcode has no parameters.
[the_author_url]
Template Tag: the_author_url()
This shortcode has no parameters.
[the_author_email]
Template Tag: the_author_email()
This shortcode has no parameters.
[the_author_link]
Template Tag: the_author_link()
This shortcode has no parameters.
[the_author_aim]
Template Tag: the_author_aim()
This shortcode has no parameters.
[the_author_yim]
Template Tag: the_author_yim()
This shortcode has no parameters.
[the_author_posts]
Template Tag: the_author_posts()
This shortcode has no parameters.
[the_author_posts_link]
Template Tag: the_author_posts_link()
This shortcode has no parameters.
[the_modified_author]
Template Tag: the_modified_author()
This shortcode has no parameters.

Category Shortcodes

[wp_list_categories]
Template Tag: wp_list_categories()
Parameters: show_option_all, order, orderby, show_last_update, style, show_count, hide_empty, use_desc_for_title, child_of, feed, feed_image, exclude, include, current_category, hierarchical, title_li, echo, depth, number
[wp_dropdown_categories]
Template Tag: wp_dropdown_categories()
Parameters: show_option_none, show_option_all, order, orderby, show_last_update, style, show_count, hide_empty, use_desc_for_title, child_of, feed, feed_image, exclude, include, current_category, hierarchical, title_li, echo, depth, number, selected, name, class, postform
[the_category]
Template Tag: the_category()
Parameters: separator, parents
[get_category_link]
Template Tag: get_category_link()
Parameters: category_id

Date and Time Shortcodes

[the_date]
Template Tag: the_date()
Parameters: format, before, after
[the_time]
Template Tag: the_time()
Parameters: format
[the_modified_date]
Template Tag: the_modified_date()
Parameters: format
[the_modified_time]
Template Tag: the_modified_time()
Parameters: format

Tag shortcodes

[wp_tag_cloud]
Template Tag: wp_tag_cloud()
Parameters: taxonomysmallest, largest, unit, number, format, order, orderby, exclude, include, link
[the_tags]
Template Tag: the_tags()
Parameters: before, separator, after
[get_tag_link]
Template Tag: get_tag_link()
Parameters: tag_id

Taxonomy shortcodes

[the_terms]
Parameters: id, taxonomy, separator, before, after
[term_description]
Template Tag: term_description()
Parameters: term, taxonomy

Bookmarks/Links shortcodes

[wp_list_bookmarks]
Template Tag: wp_list_bookmarks()
Parameters: categorize, category, exclude_category, category_name, category_before, category_after, class, category_orderby, category_order, title_li, title_before, title_after, show_private, include, exclude, orderby, order, limit, before, after, link_before, link_after, between, show_images, show_description, show_name, show_rating, show_updated, hide_invisible

Post Shortcodes

[the_title]
Template Tag: the_title()
Parameters: before, after
[the_title_attribute]
Template Tag: the_title_attribute()
Parameters: before, after
[the_ID]
Template Tag: the_ID()
This shortcode has no parameters.
[the_permalink]
Template Tag: the_permalink()
This shortcode has no parameters.
[get_permalink]
Template Tag: get_permalink()
Parameters: id
[comments_link]
Template Tag: comments_link()
This shortcode has no parameters.

General Shortcodes

[wp_list_pages]
Template Tag: wp_list_pages()
Parameters: depth, show_date, date_format, child_of, exclude, include, title_li, authors, sort_column, link_before, link_after, exclude_tree, sort_order, depth, hierarchical, meta_key, meta_value
[wp_dropdown_pages]
Template Tag: wp_dropdown_pages()
Parameters: name, show_option_none, selected, depth, show_date, date_format, child_of, exclude, include, title_li, authors, sort_column, exclude_tree, sort_order, depth, hierarchical, meta_key, meta_value
[wp_get_archives]
Template Tag: wp_get_archives()
Parameters: type, limit, format, before, after, show_post_count
[bloginfo]
Template Tag: bloginfo()
Parameters: show
[allowed_tags]
Template Tag: allowed_tags
This shortcode has no parameters.
[wp_logout_url]
Template Tag: wp_logout_url()
Parameters: redirect
[wp_login_url]
Template Tag: wp_login_url()
Parameters: redirect

Get involved

WordPress has tons of template tags. Choosing which should be a converted to shortcodes is tough work. I probably won't use most of them, but there may particular shortcodes you'd like to see. If so, just let me know about it. I'll be happy to add it to the plugin (if possible).

Plugin support

I run a WordPress community called Theme Hybrid, which is where I fully support all of my WordPress projects, including plugins. You can sign up for an account to get plugin support for a small yearly fee ($25 USD at the time of writing).

I know. I know. You might not want to pay for support, but just consider it a donation to the project. To continue making cool, GPL-licensed plugins and having the time to support them, I must pay the bills.

Copyright & license

Template Tag Shortcodes is licensed under the GNU General Public License, version 2 (GPL).

This plugin is copyrighted to Justin Tadlock.

2009 © Justin Tadlock