Template Tags

Template Tages are PHP functions used in template files (php files on your web server). You cannot use template tags directly in your posts or pages. You can use HTML, CSS and Javascript in your posts and pages however. WordPress themes contain template files and template files contain template tags.

One of the most simple template files is the footer.php file. Shown below is the file from the Expound theme, not the current theme in this site. Each footer.php file will be different for each theme you use, but there are many similarities. bloginfo() is one example of a template tag. This template tag takes parameters such as 'name' and 'description' and 'url' and 'admin_email' and 'version'. You could display the version of WordPress you are using but that is not recommended for security reasons. It gives hackers information that might help them to hack your site.


Looking again at the footer of the WordPress website you can see the code below. Below is the code for the footer.

 * The template for displaying the footer.
 * Contains the closing of the id=main div and all content after
 * @package Expound
	</div><!-- #main -->
	<footer id="colophon" class="site-footer" role="contentinfo">
		<div class="site-info">
                  <div align="center">
			&copy; Copyright <?php echo date('Y'); ?> by <?php bloginfo('name'); ?> - 
                        <?php bloginfo('description'); ?>

		</div><!-- .site-info -->
	</footer><!-- #colophon -->
</div><!-- #page -->

<?php wp_footer(); ?>


Template Tags

You can change the footer code to use template tags. Be sure to use a child theme when doing this. For an introduction to template tags in WordPress, have a look at this article in the Codex.