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.
template-tag-shortcodes.zip
folder.template-tag-shortcodes
folder to your /wp-content/plugins
directory.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.
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:
optioncount
, exclude_admin
, show_fullname
, hide_empty
, feed
, feed_image
, style
, html
field
, user_id
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
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
separator
, parents
category_id
format
, before
, after
format
format
format
taxonomy
smallest
, largest
, unit
, number
, format
, order
, orderby
, exclude
, include
, link
before
, separator
, after
tag_id
id
, taxonomy
, separator
, before
, after
term
, taxonomy
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
before
, after
before
, after
id
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
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
type
, limit
, format
, before
, after
, show_post_count
show
redirect
redirect
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).
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.
Template Tag Shortcodes is licensed under the GNU General Public License, version 2 (GPL).
This plugin is copyrighted to Justin Tadlock.
2009 © Justin Tadlock