The Tuts+ Guide to Template Tags: Series Finale

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:

  1. What template tags are
  2. Where they are
  3. How are the functions made
  4. 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":

  1. We got and displayed the post content with get_the_content() and the_content().
  2. We got and displayed the post content for feeds with get_the_content_feed() and the_content_feed().
  3. We got and displayed the excerpt of the post with get_the_excerpt() and the_excerpt().
  4. We displayed the excerpt of the post for feeds with the_excerpt_rss().
  5. We got and displayed the post title with get_the_title() and the_title().
  6. We got and displayed the "escaped" post title with the_title_attribute().
  7. We displayed the post title for feeds with the_title_rss().
  8. We got and displayed the date of the post with get_the_date() and the_date().
  9. We got and displayed the date of the post in ISO 8601 format with the_date_xml().
  10. We got and displayed the time of the post with get_the_time() and the_time().
  11. We got and displayed the author's name with get_the_author() and the_author().
  12. We displayed all the meta data of the post with the_meta().
  13. We got and displayed the modification date of the post with get_the_modified_date() and the_modified_date().
  14. We got and displayed the modification time of the post with get_the_modified_time() and the_modified_time().
  15. We got and displayed the author who edited the current post with get_the_modified_author() and the_modified_author().
  16. 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:

  1. We retrieved the description of a category with category_description().
  2. We retrieved the description of a tag with tag_description().
  3. We retrieved the description of a term with term_description().
  4. We got and displayed a page title for category archives with single_cat_title().
  5. We got and displayed a page title for tag archives with single_tag_title().
  6. We got and displayed a page title for term archives with single_term_title().
  7. We got and displayed the categories of the post with get_the_category_list() and the_category().
  8. We got and displayed the categories of the post for feeds with get_the_category_rss() and the_category_rss().
  9. We got and displayed the tags of a post with get_the_tag_list() and the_tags().
  10. We got and displayed the terms of a post with get_the_term_list() and the_terms().
  11. We displayed the taxonomies of a post with the_taxonomies().
  12. We got and displayed the "edit tag" link with get_edit_tag_link() and edit_tag_link().
  13. We got and displayed a list of categories with wp_list_categories().
  14. We got and displayed an HTML dropdown of categories with wp_dropdown_categories().
  15. We got and displayed the tag cloud with wp_tag_cloud().
  16. We retrieved a custom generated tag cloud with wp_generate_tag_cloud().

In the third batch, we reviewed template tags about comments:

  1. We got and displayed the comment author's name with get_comment_author() and comment_author().
  2. We got and displayed the comment author's name for feeds with get_comment_author_rss() and comment_author_rss().
  3. We got and displayed the comment author's email address with get_comment_author_email() and comment_author_email().
  4. We got and displayed a link of the comment author's email address with get_comment_author_email_link() and comment_author_email_link().
  5. We got and displayed the URL of the commenter with get_comment_author_url() and comment_author_url().
  6. We got and displayed the link of the commenter (with author name as anchor text) with get_comment_author_link() and comment_author_link().
  7. We got and displayed the link of the commenter (with custom text) with get_comment_author_url_link() and comment_author_url_link().
  8. We got and displayed the IP address of the commenter with get_comment_author_ip() and comment_author_ip().
  9. We got and displayed the content of the comment with get_comment_text() and comment_text().
  10. We displayed the content of the comment for feeds with comment_text_rss().
  11. We got and displayed an excerpt of the comment with get_comment_excerpt() and comment_excerpt().
  12. We got and displayed the date of the comment with get_comment_date() and comment_date().
  13. We got and displayed the time of the comment with get_comment_time() and comment_time().
  14. We got and displayed the ID of the comment with get_comment_id() and comment_id().
  15. We displayed the type of the comment with comment_type().
  16. 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:

  1. We got and displayed a link to the "comments" section with get_comments_link() and comments_link().
  2. We got and displayed the list of comments with wp_list_comments().
  3. We got and displayed the number of comments with get_comments_number() and comments_number().
  4. We got and displayed automatic classes for each comment with get_comment_class() and comment_class().
  5. We displayed the comment form with comment_form().
  6. We displayed a title for the comment form with comment_form_title().
  7. We got and displayed the "reply to comment" link with get_comment_reply_link() and comment_reply_link().
  8. We got and displayed the hidden fields of the "reply to comment" form with get_comment_id_fields() and comment_id_fields().
  9. We got and displayed the "cancel reply" link with get_cancel_comment_reply_link() and cancel_comment_reply_link().
  10. We got and displayed the link for "next comments" with get_next_comments_link() and next_comments_link().
  11. We got and displayed the link for "previous comments" with get_previous_comments_link() and previous_comments_link().
  12. We retrieved pagination links for the comments with paginate_comments_links().
  13. We got and displayed the "edit comment" link with get_edit_comment_link() and edit_comment_link().
  14. We got and displayed the "comments feed" link with get_post_comments_feed_link() and post_comments_feed_link().
  15. We displayed a link of the "comments" popup with comments_popup_link().
  16. We displayed the "comments" popup script with comments_popup_script().

In the fifth batch, we reviewed template tags about posts, pages and template parts:

  1. We got and displayed automatic classes for each post with get_post_class() and post_class().
  2. We got and displayed the permanent link of current post with get_permalink() and the_permalink().
  3. We got and displayed the post ID with get_the_id() and the_id().
  4. We got and displayed a page title for the post with single_post_title().
  5. We got and displayed the link of the next post with get_next_post_link() and next_post_link().
  6. We got and displayed the link of the previous post with get_previous_post_link() and previous_post_link().
  7. We retrieved the permalink of the page with get_page_link().
  8. We got and displayed the permalink of a post with get_post_permalink() and post_permalink().
  9. We got and displayed the shortlink of the post with wp_get_shortlink() and the_shortlink().
  10. We got and displayed the "edit post" link with get_edit_post_link() and edit_post_link().
  11. We retrieved the "delete post" link with get_delete_post_link().
  12. We displayed a permalink "anchor" for the current post with permalink_anchor().
  13. We made WordPress load the header template with get_header().
  14. We made WordPress load the footer template with get_footer().
  15. We made WordPress load the sidebar template with get_sidebar().
  16. We made WordPress load a template file with get_template_part().

In the sixth batch, we reviewed template tags about authors and attachments:

  1. We retrieved the URL of the author's post archives with get_author_posts_url().
  2. We displayed a link to the author's post archives with the_author_posts_link().
  3. We got and displayed the author's website link with get_the_author_link() and the_author_link().
  4. We got and displayed the author's meta data with get_the_author_meta() and the_author_meta().
  5. We got and displayed the post count of the author with get_the_author_posts() and the_author_posts().
  6. We got and displayed the list of authors with wp_list_authors().
  7. We got and displayed an HTML dropdown of users with wp_dropdown_users().
  8. We got and displayed the featured image of the post with get_the_post_thumbnail() and the_post_thumbnail().
  9. We retrieved the ID of the post's featured image with get_post_thumbnail_id().
  10. We got and displayed the permalink of an attachment page with wp_get_attachment_link() and the_attachment_link().
  11. We retrieved the attachment image with wp_get_attachment_image().
  12. We retrieved the attachment image URL with wp_get_attachment_image_src().
  13. We retrieved the attachment image meta data with wp_get_attachment_metadata().
  14. We retrieved the next image of the same post with next_image_link().
  15. 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:

  1. We retrieved the archive link with get_archives_link().
  2. We got and displayed the archive links with wp_get_archives().
  3. We got and displayed title for a post type archive with post_type_archive_title().
  4. We got and displayed a page title for monthly archives with single_month_title().
  5. We got and displayed the link for the "next posts" page with get_next_posts_link() and next_posts_link().
  6. We got and displayed the link for the "previous posts" page with get_previous_posts_link() and previous_posts_link().
  7. We got and displayed links for the "next & previous posts" pages with get_posts_nav_link() and posts_nav_link().
  8. We got and displayed the search form with get_search_form().
  9. We got and displayed the current search query with get_search_query() and the_search_query().
  10. We retrieved a permalink for a search query with get_search_link().
  11. We got and displayed a "register" or "dashboard" link with wp_register().
  12. We got and displayed the "log in" form with wp_login_form().
  13. We got and displayed the "log in/out" link with wp_loginout().
  14. We retrieved the "log in" URL with wp_login_url().
  15. We retrieved the "log out" URL with wp_logout_url().
  16. 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:

  1. We retrieved a list of all bookmarks with get_bookmarks().
  2. We got and displayed the list of bookmarks with wp_list_bookmarks().
  3. We retrieved bookmark data with get_bookmark().
  4. We retrieved a single bookmark field's data with get_bookmark_field().
  5. We got and displayed the "edit bookmark" link with get_edit_bookmark_link() and edit_bookmark_link().
  6. We got and displayed your site's information with get_bloginfo() and bloginfo().
  7. We got and displayed automatic <body> classes with get_body_class() and body_class().
  8. We got and displayed a navigation menu with wp_nav_menu().
  9. We got and displayed page titles with wp_title().
  10. We got and displayed the home URL with get_home_url() and home_url().
  11. We got and displayed the site URL with get_site_url() and site_url().
  12. We retrieved the current site's ID with get_current_blog_id().
  13. We got and displayed the URL of the admin panel with get_admin_url() and admin_url().
  14. We got and displayed the permalink of a feed type with get_feed_link() and the_feed_link().
  15. We made the string end with or without a trailing slash with user_trailingslashit().
  16. We retrieved number of days since the start of the week with calendar_week_mod().
  17. 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!

Tags:

Comments

Related Articles