20 super helpful Wordpress template tags

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 [...]

Author : Cyrus

Author's Website | Articles from Cyrus

Cyrus is a social worker and community organizing guru in Vermont.

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.

Like this post? Share it!

  • Tweet
  • Facebook
  • Diggit
  • Delicious
  • Diggit
  • Diggit
  • Diggit

Use the same Wordpress theme as us:


User Comments


  1. Diego
    December 11, 2009

    Bookmarked, thank you!



  2. Shekhar from free wordpress templates
    February 11, 2010

    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…



  3. Chasey
    February 12, 2010

    Although you can put Template Tags and PHP code into a Page Template, you cannot put these into the content of a Page and expect them to run.


Leave a Reply

Comment Policy: This site uses KeywordLuv. Enter YourName@YourKeywords in the Name field to take advantage. Comments that use keywords in the name field in the incorrect format will not be approved. Links to inappropriate sites will also not be approved. Do not bother wasting my time by thanking me for a post. Add something to the discussion or your comment will be deleted

Rss Feeds   Twitter Followers Email Updates