O'Reilly logo

WordPress® All-in-One For Dummies® by Michael Torbert, Andrea Rennick, Kevin Palmer, Cory Miller, Lisa Sabin-Wilson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Customizing Your Blog Posts with Template Tags

This section covers the template tags that you use to display the body of each 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. Table 3-4 lists the common template tags you can use for posts, available for you to use in any WordPress theme template. The tags in Table 3-4 work only if you place them within The Loop (covered earlier in this chapter and found in the loop.php template file).

Table 3-4 Template Tags for Blog Posts

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.
the_permalink(); Displays the permalink (URL) of the post.
get_the_author(); Displays the post author' name.
the_author_link(); Displays the URL of the post author' site.
the_content(‘Read More...’); Displays the content of the post. (If you use an excerpt [below], 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, commas will separate them.
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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required