20 super helpful WordPress template tags

For anyone developing WordPress templates, these tags are the most commonly used and helpful to have handy. Many of these tags include parameter options which can be found in the WordPress Codex or this helpful tool.

<?php the_author_nickname(); ?>

Insert the author’s nickname.

<?php the_category('parents=multiple'); ?>

Insert the category of a post.

<?php comments_number('No Comments', 'one', 'more', 'number'); ?>

Insert the number of comments if there are none.

<?php comments_number('zero', '1 Comment', 'more', 'number'); ?>

Insert the number of comments if there is only one.

<?php comments_number('zero', 'one', '% Comments', 'number'); ?>

Insert the number of comments for more than one.

<?php the_date('n-j-Y', 'before', 'after', echo); ?>

Insert the comment date (uses the default format)

<?php bloginfo('name'); ?>

The name of your blog.

<?php bloginfo('description'); ?>

Your blog description.

<?php bloginfo('url'); ?>

Your blog URL, (helpful in structuring backlinks)

<?php bloginfo('rss_url'); ?>

The link to your RSS feed.

<?php bloginfo('template_directory'); ?>

The template directory (most useful for referencing images)

<?php get_posts('numberposts=10'); ?>

Display some posts, in this case, 10.

<?php get_posts('category=2'); ?>

Display posts from a specific category. Both this and the previous tag can be combined.

<?php wp_list_pages(); ?>

Lists pages with URLs.

<?php wp_list_pages('include=50'); ?>

Lists page with id 50

<?php wp_list_pages('exclude=50'); ?>

Lists all pages except those with id 50

<?php the_permalink(); ?>

The link to a post, (must be used within the loop)

<?php the_title(); ?>

The title of the post.

<?php the_content(); ?>

The content of a post.

<?php the_excerpt(); ?>

The excerpt of a post. A tag used a lot on this site. Limits content words and strips HTML tags.

6 thoughts on “20 super helpful WordPress template tags”

  1. Great Post cyrus ! Learned alot of things here..Wordpress is every where now you see..They have out matched joomla in execution speed and wide template availibility…

  2. Hey thanks for posting these up. I’ve made a note of these ones because there are sooo many they’re really difficult to find. I’ve already got a couple of pages full of ones I’ve found around the net because it makes it so much easier.

  3. Thanks Cyrus there is a good amoun of information here. I use wordpress all the time and these links will be useful. Cheers.

Leave a Reply

Your email address will not be published. Required fields are marked *