How To Use Template Tags In WordPress Theme

What is meaning of a Template Tag in WordPress

A template tag is code that instructs WordPress to “do” or “get” something. In the case of the header.php template tag for your WordPress site’s name, it looks like this:

php bloginfo(‘name’); ?> // this will print the blog name

Following are the more public methods.

name php bloginfo('name'); ?>

As mentioned, this displays the name of the site and is set by the administrator in the Options > General SubPanel by default.

description php bloginfo('description'); ?>

This is called the “Tagline” for your blog which is usually some kind of descriptive sentence that says “My blog is about….”. It is set by the administrator in the Options > General SubPanel.

url php bloginfo('url'); ?>

When you want to display the URL or website address for your WordPress site, you can use URL and it will show up. This also comes from the Options > General SubPanel.

admin_email php bloginfo('admin_email'); ?>

If you want to display the email of the administrator, you don’t have to type it into the template files. By doing so, it may be open to email harvesters who use sophisticated software to come in and grab email addresses to use for spam. By using bloginfo('admin_email'), the email is displayed on the page for the viewers, but the actual email address is disguised from the harvesters. Nice, huh? The administrator’s email address is set in the Options > General SubPanel.

version bloginfo('version'); ?>

Sometimes you’d like to show off which version of WordPress you are using. The Themes that come with WordPress by default include this information in the footer template. It simply displays the version of WordPress your blog uses.

Published by

Purab

I am Purab from India, Software development is my profession and teaching is my passion. Programmers blog dedicated to the JAVA, Python, PHP, DevOps and Opensource Frameworks. Purab's Github Repo Youtube Chanel Video Tutorials Connect to on LinkedIn

One thought on “How To Use Template Tags In WordPress Theme”

Leave a Reply

Your email address will not be published.