How to Customize Your Blog Posts with Template Tags - dummies

How to Customize Your Blog Posts with Template Tags

By Lisa Sabin-Wilson

Here, you will find the template tags that you use to display the body of each WordPress blog post you publish. The body of a blog post includes information such as the post date and time, title, author name, category, and content.

Take a look at the common template tags you can use for posts, available for you to use in any WordPress theme template. These tags work only if you place them within The Loop.

Tag Function
get_the_date(); Displays the date of the post.
get_the_time(); Displays the time of the post.
the_title(); Displays the title of the post.
get_permalink(); Displays the permalink (URL) of the post.
get_the_author(); Displays the post author’s name.
the_author_posts_url(); Displays the URL of the post author’s site.
Displays the content of the post. (If you use an excerpt [next
item], the words Read More appear and are linked to the
individual post page.)
the_excerpt(); Displays an excerpt (snippet) of the post.
the_category(); Displays the category (or categories) assigned to the post. If
the post is assigned to multiple categories, they’ll be
separated by commas.
comments_popup_link(‘No Comments’, ‘Comment
(1)’, ‘Comments(%)’);
Displays a link to the comments, along with the comment count
for the post in parentheses. (If no comments exist, it displays a
No Comments message.)
next_posts_link(‘« Previous
Displays the words Previous Entries linked to the
previous page of blog entries.
previous_posts_link(‘Next Entries
Displays the words Next Entries linked to the next page
of blog entries.

The last two tags aren’t like the others. You don’t place these tags in The Loop; instead, you insert them after The Loop but before the if statement ends. Here’s an example:

<?php endwhile; ?>
<?php next_posts_link('&laquo; Previous Entries') ?>
<?php previous_posts_link('Next Entries &raquo;') ?>
<?php endif; ?>