WordPress Template Tags are used within the template files to dynamically display the content of your blog. They provide the tools you need to make specific requests to your database and return a set of results. Template Tags are on the greatest things about working with a platform such as WP, because they allow you to accomplish so much with little code.
Although there are tons of different tags used in the development and customization of WordPress themes, there are some that are extremely important and useful and you will see them in most themes.
Below I have provided you with a quick list of some of the key template tags to make your next Theme Development project a breeze.
/*
Theme Name: WordPress
Theme URI: http://wpexplorer.com
Description: WordPress Template Tags Cheat Sheet
Version: 1.0
Author: WpExplorer
Author URI: http://wpexplorer.com
Tags: worpress, cheat, sheet,wordpress, tags, template
*/
header.php …………………………………………………… Header Section
index.php …………………………………………………….. Main Section (homepage)
sidebar.php …………………………………………………… Sidebar Section
single.php …………………………………………………….. Post Template
page.php ………………………………………………………. Page Template
comments.php ………………………………………………. Comment Template
search.php ……………………………………………………. Search Content
searchform.php ……………………………………………… Search Form Template
archive.php …………………………………………………… Archive Template
functions.php ………………………………………………… Special Functions
404.php ……………………………………………………….. Error Page template
style.css ……………………………………………………….. Style Sheet
< ?php get_header(); ?>
< ?php get_sidebar(); ?>
< ?php get_footer(); ?>
< ?php comments_template(); ?>
Displays the posts/pages title
<?php the_title() ?>
<?php the_ID(); ?>
Displays the content of the post/page
<?php the_content() ?>
Displays the excerpt of the current post/page
<?php the_excerpt() ?>
Displays the time of the current post/page
<?php the_time() ?>
Displays all the pages
<?php wp_list_pages(); ?>
Displays a tag cloud
<?php wp_tag_cloud(); ?>
Displays the categories
<?php wp_list_cats(); ?>
Displays the calendar
<?php get_calendar(); ?>
Displays a date-based archives list
<?php wp_get_archives() ?>
Displays Previous page and Next Page links
<?php posts_nav_link(); ?>
Displays Newer Posts link
<?php next_post_link() ?>
Displays previous link
<?php previous_post_link() ?>
Displays the edit link
<?php edit_post_link(__(‘Edit Post’)); ?>
Value for search form
<?php the_search_query();?>
Displays the register link
<?php wp_register();?>
Displays the log in/out link
<?php wp_loginout();?>
Meta for administrators
<?php wp_meta();?>
Time to load the page
<?php timer_stop(1);?>
Displays the custom field1
<?php echo c2c_custom(‘test’);?>
Display links from Blogroll
<?php get_links_list(); ?>
Displays the built-in calendar
<?php get_calendar(); ?>
Link of the posts comments
<?php comments_popup_link(); ?>
Displays the date
<?php the_date() ?>
Displays the URL for the permalink
<?php the_permalink() ?>
Displays the category
<?php the_category() ?>
Displays the author
<?php the_author(); ?>
Title of the blog:
<?php bloginfo(‘name’); ?>
HTML version of the site
<?php bloginfo(‘html_type’); ?>
The character set
<?php bloginfo(‘charset’); ?>
The description of the blog
<?php bloginfo(‘description’); ?>
The address of the blog
<?php bloginfo(‘url’); ?>
The RSS URL
<?php bloginfo(‘rss2_url’); ?>
The URL of the template
<?php bloginfo(‘template_url’); ?>
The pingback URL
<?php bloginfo(‘pingback_url’); ?>
The URL for the template’s CSS file
<?php bloginfo(’stylesheet_url’); ?>
URL for WordPress installation
<?php bloginfo(‘wpurl’); ?>
Show WP Version
<?php bloginfo(‘version’); ?>
is_home() ……………………………. Do task if the user is on the blog home page
is_front_page() …………………….. Do task when the user is on the home page
is_single() ……………………………. Do task if when the single post displayed
is_sticky() …………………………….Check to see if a post is sticky
is_page() ………………………………Do task as soon as a page is displayed
is_category() ………………………… Do task if when a category is displayed
We believe that we have provided a pretty solid Template Tag Cheat-sheet, however, we know are work is not always the best out there and there are many other resources similar and possibly better than ours. For this reason we have provided links to other great Template Tag lists that you can bookmark as well and use for your next theme development or customization.
Enjoy, and don’t for get to link back to our post!
WordPress.org Codex
You can not have a complete WP Template Tag resource page without a link to the “Big Guy”, WordPress.org. Clearly as the developers of the platform they have the most complete list of tags out there. There codex is quite extensive, which is why we have provided the cheatsheet above, however if we are missing something here they are sure to have it.
DBSWebsite.com
This is a nice reference guide that can be used to browse through the various WordPress tags. Using a neat javascript function you can click on any tag and read more about it and how to use it. This is probably one of the top guides out there.
Template Tag Look-up Tool
Here is yet another great WordPress Template Tag tool to help you in your next project. Created by themelab.com, this ajax powered tool will allow you to quickly and easily look-up any tag simply by typing into the search bar.
Wow, this is a great list of the wp tags. Will definitely bookmark for my next theme design project.
Thanks for this, I will definitely pass it on.