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).
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 ... |
Get WordPress® All-in-One For Dummies® now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.