Display Content with WordPress Template Tags
When you create a WordPress theme, you use a combination of template tags to display certain types of content, such as blog posts, calendars, navigation menus, page content, archive links, and so on. Take a look at common template tags that tell WordPress what information you want to display on your site.
WordPress also lets you create different templates that handle specific types of content, such as categories, archives, search results, author pages, and more. Here are methods of creating content-specific templates to drive the content delivery and visual look of your site.
Template tags for many items are commonly placed in the sidebar of a site. It's possible to get creative with these template tags and place them in other locations, such as the Footer template; but to keep this introduction to sidebar template tags simple, stick with the most common use, leaving the creative and uncommon uses for when you're comfortable with the basics.
You can include tag parameters in the tag to control some of its display properties. 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're 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.
You place tag parameters inside the parentheses of the tag. Keep in mind that not all template tags have parameters.
The calendar template tag, as one common example, displays a calendar that highlights each day of the week on which you've created a blog post. Those days are also hyperlinked to the original blog post. Here's the tag to use to display the calendar:
<?php get_calendar(); ?>
The get_calendar(); tag has only one parameter, and it’s Boolean. Set this parameter to true, and it displays the day of the week with one letter (Friday = F, for example). Set this parameter to false, and it displays the day of the week as a three-letter abbreviation (Friday = Fri., for example). Here are examples of the template tag used to display the calendar on your WordPress site:
<?php get_calendar(true); ?> <?php get_calendar(false); ?>