How to Use Tags with Parameters for Sidebars in WordPress

By Lisa Sabin-Wilson

Here, you find the template tags for the items that are commonly placed on the sidebar of a WordPress site. Commonly placed is used here 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, stick with the most common use, leaving the creative and uncommon uses for you to try when you’re comfortable with the basics.

You will also see tag parameters introduced here, 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 here were obtained from the WordPress software documentation in the WordPress Codex.

This table helps you understand the three variations of parameters used in WordPress.

Three Variations of Template Parameters
Variation Description Example
Tags without parameters These tags have no additional options. Tags without parameters have nothing within the parentheses. the_tag();
Tags with PHP function–style parameters These tags have a comma-separated list of values placed within the tag parentheses. the_tag( '1,2,3' );
Tags with query-string parameters These tags generally have several parameters. 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. the_tag( 'parameter=true ');

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, WordPress processes them correctly.
  • Boolean: A parameter that sets the 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.

The WordPress Codex has every conceivable template tag and possible parameter known to the WordPress software.