Using Tags with Parameters for Sidebars

If you've been following along in this chapter as I've covered the Header and Main Index templates and tags, you have a functional WordPress blog with blog posts and various metadata displayed in each post.

In this section, I give you the template tags for the items commonly placed in the sidebar of a blog. I say "commonly placed" because it's possible to get creative with these template tags and place them in other locations (the Footer template, for example). To keep this introduction to sidebar template tags simple, I stick with the most common use, leaving the creative and uncommon uses to you to try when you're comfortable with building the basics.

This section also introduces tag parameters, which are additional options you can include in the tag to control some of its display properties. Not all template tags have parameters. You place tag parameters inside the parentheses of the tag. Many of the parameters discussed in this section were obtained from the WordPress software documentation in the WordPress Codex at

Table 12-4 helps you understand the three variations of parameters used by WordPress.

Table 12-4 Three Variations of Template Parameters




Tags without

These tags have no additional

the_tag ();


options available. Tags with

out parameters have nothing

within the parentheses.

function-style parameters

These tags have a comma-separated list of values placed within the tag parentheses.


Tags with These types of tags generally the_tag query-string have several available param- ('parameter=true);

parameters eters. This tag style enables you to change the value for each parameter without being required to provide values for all available parameters for the tag.

Identifying some blog-post metadata

Metadata is simply data about data. In ✓ The category or categories to which the WordPress, metadata refers to the data about post is assigned each blog post, including:

✓ The comments link and number of comments

You need to know these three types of parameters:

✓ String: A line of text that can be anything from a single letter to a long list of words. A string is placed between single quotation marks and sets an option for the parameter or is displayed as text.

✓ Integer: A positive or negative number. Integers are placed within the parentheses and either inside or outside single quotation marks. Either way, they'll be processed correctly.

✓ Boolean: Sets the parameter options to true or false. This parameter can be numeric (0 = false and 1=true) or textual. Boolean parameters aren't placed within quotation marks.

kBE# The WordPress Codex, located at, has every conceivable template tag and possible parameter known to the WordPress software. The tags and parameters that I share with you in this chapter are the ones used most often.

Was this article helpful?

0 0

Post a comment