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 Spencer (see all)
- Best WYSIWYG – Drag And Drop Website Builders - June 27, 2021
- Udemy Review - June 27, 2021
- 33 Of The Best Photo Management Software of 2021 (Ultimate Guide) - June 24, 2021