What is: Template Tag?

As all of WordPress is written in the PHP programming language, template tags are a PHP function used to either generate or display information on the fly. Essentially, template tags are much like regular tags that you can add to your posts in that they are used to identify and sort information inside the template.

WordPress comes built-in with several template tags, but you can also design your own. For example, one of the built-in template tags is “get_header()” which, much as you might expect, retrieves the header information from the template.

In short, a template tag is a tiny snippet of PHP code that tells WordPress to either do something or else to retrieve something. If you look inside the “header.php” file on your WordPress site, you’ll see a string that contains “bloginfo.” This is the template tag that tells your WordPress site how to display the name of your website (the default setting is to use the H1 header tag when showing your website’s name).

Template tags also come with parameters, including:

name – The name of your website.
description – Also known as your website’s “tagline,” a brief description of what your site is all about.
url – To reveal the URL or internet address for your website.
version – The current version of WordPress that you are using. When WordPress is first installed, it comes with a theme that displays this information in the footer section.
admin_email – To reveal your website’s administrator email.

You can code new template tags yourself or install plugins that will do it automatically.

Because template tags are PHP functions, you can also use them inside other PHP functions, mixing and combining them as you like in order to get a software command to do something.

The following two tabs change content below.

Jamie

My name is Jamie Spencer and I have spent the past 5 years building money making blogs. After growing tired of the 9-5, commuting and never seeing my family I decided that I wanted to make some changes and launched my first blog. Since then I have launched lots of successful niche blogs and after selling my survivalist blog I decided to teach other people how to do the same.