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.
Latest posts by Jamie (see all)
- 2020 Social Media Image Sizes Cheat Sheet - December 4, 2019
- Best WordPress Membership Plugins for 2019 - December 4, 2019
- 30 Best Social Sharing Plugins For WordPress – 2019 - November 18, 2019