Welcome to the series finale of "The Tuts+ Guide to Template Tags"! It's been a long but great journey, as I said it would be in the first part. And in this last post, we're going to review what we've learned and conclude the series.
First Part
In the first part of the series, we introduced the concept of "template tags" in WordPress: We saw:
- What template tags are
- Where they are
- How are the functions made
- How to use the functions
As I stated a couple of times, template tags are one of the most important and one of the easiest WordPress concepts to learn about. It's only a matter of memorizing the functions and their parameters, just as we need to memorize many PHP functions while learning PHP.
Middle Parts
In the middle parts of the series, we reviewed almost 200 template tags, which are documented in the Codex. Of course, there are many more (maybe twice as more) template tags out there in the core of WordPress, and it would be another journey to review them.
I split the template tags into categorized "batches" to make it easier to learn the template tags in each part. In the first batch, we reviewed template tags about "post data":
- We got and displayed the post content with
get_the_content()
and the_content()
.
- We got and displayed the post content for feeds with
get_the_content_feed()
and the_content_feed()
.
- We got and displayed the excerpt of the post with
get_the_excerpt()
and the_excerpt()
.
- We displayed the excerpt of the post for feeds with
the_excerpt_rss()
.
- We got and displayed the post title with
get_the_title()
and the_title()
.
- We got and displayed the "escaped" post title with
the_title_attribute()
.
- We displayed the post title for feeds with
the_title_rss()
.
- We got and displayed the date of the post with
get_the_date()
and the_date()
.
- We got and displayed the date of the post in ISO 8601 format with
the_date_xml()
.
- We got and displayed the time of the post with
get_the_time()
and the_time()
.
- We got and displayed the author's name with
get_the_author()
and the_author()
.
- We displayed all the meta data of the post with
the_meta()
.
- We got and displayed the modification date of the post with
get_the_modified_date()
and the_modified_date()
.
- We got and displayed the modification time of the post with
get_the_modified_time()
and the_modified_time()
.
- We got and displayed the author who edited the current post with
get_the_modified_author()
and the_modified_author()
.
- We got and displayed a list of pages of paginated posts with
wp_link_pages()
.
In the second batch, we reviewed template tags about taxonomies and terms:
- We retrieved the description of a category with
category_description()
.
- We retrieved the description of a tag with
tag_description()
.
- We retrieved the description of a term with
term_description()
.
- We got and displayed a page title for category archives with
single_cat_title()
.
- We got and displayed a page title for tag archives with
single_tag_title()
.
- We got and displayed a page title for term archives with
single_term_title()
.
- We got and displayed the categories of the post with
get_the_category_list()
and the_category()
.
- We got and displayed the categories of the post for feeds with
get_the_category_rss()
and the_category_rss()
.
- We got and displayed the tags of a post with
get_the_tag_list()
and the_tags()
.
- We got and displayed the terms of a post with
get_the_term_list()
and the_terms()
.
- We displayed the taxonomies of a post with
the_taxonomies()
.
- We got and displayed the "edit tag" link with
get_edit_tag_link()
and edit_tag_link()
.
- We got and displayed a list of categories with
wp_list_categories()
.
- We got and displayed an HTML dropdown of categories with
wp_dropdown_categories()
.
- We got and displayed the tag cloud with
wp_tag_cloud()
.
- We retrieved a custom generated tag cloud with
wp_generate_tag_cloud()
.
In the third batch, we reviewed template tags about comments:
- We got and displayed the comment author's name with
get_comment_author()
and comment_author()
.
- We got and displayed the comment author's name for feeds with
get_comment_author_rss()
and comment_author_rss()
.
- We got and displayed the comment author's email address with
get_comment_author_email()
and comment_author_email()
.
- We got and displayed a link of the comment author's email address with
get_comment_author_email_link()
and comment_author_email_link()
.
- We got and displayed the URL of the commenter with
get_comment_author_url()
and comment_author_url()
.
- We got and displayed the link of the commenter (with author name as anchor text) with
get_comment_author_link()
and comment_author_link()
.
- We got and displayed the link of the commenter (with custom text) with
get_comment_author_url_link()
and comment_author_url_link()
.
- We got and displayed the IP address of the commenter with
get_comment_author_ip()
and comment_author_ip()
.
- We got and displayed the content of the comment with
get_comment_text()
and comment_text()
.
- We displayed the content of the comment for feeds with
comment_text_rss()
.
- We got and displayed an excerpt of the comment with
get_comment_excerpt()
and comment_excerpt()
.
- We got and displayed the date of the comment with
get_comment_date()
and comment_date()
.
- We got and displayed the time of the comment with
get_comment_time()
and comment_time()
.
- We got and displayed the ID of the comment with
get_comment_id()
and comment_id()
.
- We displayed the type of the comment with
comment_type()
.
- We retrieved the avatar of a user with
get_avatar()
.
In the fourth batch, we reviewed template tags about comments again, as there are a lot of comments-related template tags:
- We got and displayed a link to the "comments" section with
get_comments_link()
and comments_link()
.
- We got and displayed the list of comments with
wp_list_comments()
.
- We got and displayed the number of comments with
get_comments_number()
and comments_number()
.
- We got and displayed automatic classes for each comment with
get_comment_class()
and comment_class()
.
- We displayed the comment form with
comment_form()
.
- We displayed a title for the comment form with
comment_form_title()
.
- We got and displayed the "reply to comment" link with
get_comment_reply_link()
and comment_reply_link()
.
- We got and displayed the hidden fields of the "reply to comment" form with
get_comment_id_fields()
and comment_id_fields()
.
- We got and displayed the "cancel reply" link with
get_cancel_comment_reply_link()
and cancel_comment_reply_link()
.
- We got and displayed the link for "next comments" with
get_next_comments_link()
and next_comments_link()
.
- We got and displayed the link for "previous comments" with
get_previous_comments_link()
and previous_comments_link()
.
- We retrieved pagination links for the comments with
paginate_comments_links()
.
- We got and displayed the "edit comment" link with
get_edit_comment_link()
and edit_comment_link()
.
- We got and displayed the "comments feed" link with
get_post_comments_feed_link()
and post_comments_feed_link()
.
- We displayed a link of the "comments" popup with
comments_popup_link()
.
- We displayed the "comments" popup script with
comments_popup_script()
.
In the fifth batch, we reviewed template tags about posts, pages and template parts:
- We got and displayed automatic classes for each post with
get_post_class()
and post_class()
.
- We got and displayed the permanent link of current post with
get_permalink()
and the_permalink()
.
- We got and displayed the post ID with
get_the_id()
and the_id()
.
- We got and displayed a page title for the post with
single_post_title()
.
- We got and displayed the link of the next post with
get_next_post_link()
and next_post_link()
.
- We got and displayed the link of the previous post with
get_previous_post_link()
and previous_post_link()
.
- We retrieved the permalink of the page with
get_page_link()
.
- We got and displayed the permalink of a post with
get_post_permalink()
and post_permalink()
.
- We got and displayed the shortlink of the post with
wp_get_shortlink()
and the_shortlink()
.
- We got and displayed the "edit post" link with
get_edit_post_link()
and edit_post_link()
.
- We retrieved the "delete post" link with
get_delete_post_link()
.
- We displayed a permalink "anchor" for the current post with
permalink_anchor()
.
- We made WordPress load the header template with
get_header()
.
- We made WordPress load the footer template with
get_footer()
.
- We made WordPress load the sidebar template with
get_sidebar()
.
- We made WordPress load a template file with
get_template_part()
.
In the sixth batch, we reviewed template tags about authors and attachments:
- We retrieved the URL of the author's post archives with
get_author_posts_url()
.
- We displayed a link to the author's post archives with
the_author_posts_link()
.
- We got and displayed the author's website link with
get_the_author_link()
and the_author_link()
.
- We got and displayed the author's meta data with
get_the_author_meta()
and the_author_meta()
.
- We got and displayed the post count of the author with
get_the_author_posts()
and the_author_posts()
.
- We got and displayed the list of authors with
wp_list_authors()
.
- We got and displayed an HTML dropdown of users with
wp_dropdown_users()
.
- We got and displayed the featured image of the post with
get_the_post_thumbnail()
and the_post_thumbnail()
.
- We retrieved the ID of the post's featured image with
get_post_thumbnail_id()
.
- We got and displayed the permalink of an attachment page with
wp_get_attachment_link()
and the_attachment_link()
.
- We retrieved the attachment image with
wp_get_attachment_image()
.
- We retrieved the attachment image URL with
wp_get_attachment_image_src()
.
- We retrieved the attachment image meta data with
wp_get_attachment_metadata()
.
- We retrieved the next image of the same post with
next_image_link()
.
- We retrieved the previous image of the same post with
previous_image_link()
.
In the seventh batch, we reviewed template tags about archives, search, login, logout, and registration:
- We retrieved the archive link with
get_archives_link()
.
- We got and displayed the archive links with
wp_get_archives()
.
- We got and displayed title for a post type archive with
post_type_archive_title()
.
- We got and displayed a page title for monthly archives with
single_month_title()
.
- We got and displayed the link for the "next posts" page with
get_next_posts_link()
and next_posts_link()
.
- We got and displayed the link for the "previous posts" page with
get_previous_posts_link()
and previous_posts_link()
.
- We got and displayed links for the "next & previous posts" pages with
get_posts_nav_link()
and posts_nav_link()
.
- We got and displayed the search form with
get_search_form()
.
- We got and displayed the current search query with
get_search_query()
and the_search_query()
.
- We retrieved a permalink for a search query with
get_search_link()
.
- We got and displayed a "register" or "dashboard" link with
wp_register()
.
- We got and displayed the "log in" form with
wp_login_form()
.
- We got and displayed the "log in/out" link with
wp_loginout()
.
- We retrieved the "log in" URL with
wp_login_url()
.
- We retrieved the "log out" URL with
wp_logout_url()
.
- We retrieved the "lost password" URL with
wp_lostpassword_url()
.
And in the last batch, we reviewed template tags about bookmarks and other, "miscellaneous" template tags:
- We retrieved a list of all bookmarks with
get_bookmarks()
.
- We got and displayed the list of bookmarks with
wp_list_bookmarks()
.
- We retrieved bookmark data with
get_bookmark()
.
- We retrieved a single bookmark field's data with
get_bookmark_field()
.
- We got and displayed the "edit bookmark" link with
get_edit_bookmark_link()
and edit_bookmark_link()
.
- We got and displayed your site's information with
get_bloginfo()
and bloginfo()
.
- We got and displayed automatic
<body>
classes with get_body_class()
and body_class()
.
- We got and displayed a navigation menu with
wp_nav_menu()
.
- We got and displayed page titles with
wp_title()
.
- We got and displayed the home URL with
get_home_url()
and home_url()
.
- We got and displayed the site URL with
get_site_url()
and site_url()
.
- We retrieved the current site's ID with
get_current_blog_id()
.
- We got and displayed the URL of the admin panel with
get_admin_url()
and admin_url()
.
- We got and displayed the permalink of a feed type with
get_feed_link()
and the_feed_link()
.
- We made the string end with or without a trailing slash with
user_trailingslashit()
.
- We retrieved number of days since the start of the week with
calendar_week_mod()
.
- We got and displayed the calendar with
get_calendar()
.
Finale
And here we are, at the end of the series. I hope you enjoyed the articles as much as I enjoyed writing them. If you have any questions, corrections or additions related to the series or the concept of "template tags" in WordPress, feel free to shoot a comment in the Comments section below.
And if you liked this series, don't forget to share the posts with your friends. Goodbye!
by Barış Ünver via Tuts+ Code