Template Tags: A template tag is PHP code that dynamically creates and displays design choices on a WordPress Site. Template tags are found within Templates and Plugins.
Example Usage: We’ve updated the post title template tag in the single post template file to be in an h1 heading not h2.
About the Word
WordPress Themes set the design for a WordPress site. Themes include template files for different aspects of a WordPress Theme, i.e., the text colors and fonts for a heading. Inside of each template file are WordPress code blocks represented by template tags, PHP code that specify the parameters of those design decisions.
Template tags are essentially PHP functions used redundantly in WordPress to generate content and code. The WordPress Loop is made up of PHP instructions combined with template tags to generate the content on every web page in WordPress. Template tags are used to generate the post or Page title, article title, author byline, meta data, dates, categories, tags, widgets, all the key elements of a WordPress site.
Not all template tags are found in every Theme. That means that even if something is defined by a template tag, unless the Theme designers have chosen to use that tag within their design.
For example, this template tag adds a black heart before and after the title:
<?php the_title('♥ ', ' ♥'); ?>
It would look like this:
♥ Title of Your Article ♥
Template tags are the basic building blocks of a WordPress site.
For More Information
- WP Beginner. What Is a Template Tag
- WordPress Codex: Template Tags
- Stepping Into Template Tags « WordPress Codex
- WordPress Code Reference
- The Archive, Author, Category & Tags Template | ThemeShaper
- Useful WordPress Template Tags for Theme Development – DesignM.ag
- In Praise of WordPress Template Tags | Darren Hoyt Dot Com