WordPress Template Tags

Learning Template Tags

The Baris Unvers Template Tags List

Baris Unvers covered 200 Template Tags in his series for envatotuts: The Tuts+ Guide to Template Tags (2015). I’m not going to try to replicate his work but I hope to make it slightly more accessible. Below you’ll find the different parts of the series, some brief comments where I felt appropriate, and a list of the template tags found in each article. Reference the actual article for information on usage.

  • Introduction – Explains what template tags are, where they are located in core code, how the functions are made, and how to use the functions.
  • First Batch – Covers the post.
    • get_the_content( $more_link_text, $strip_teaser ) / the_content( $more_link_text, $strip_teaser )
    • get_the_content_feed( $feed_type ) / the_content_feed( $feed_type )
    • get_the_excerpt() / the_excerpt()
    • the_excerpt_rss()
    • get_the_title( $post_ID ) / the_title( $before, $after, $echo )
    • the_title_attribute( $args )
      • Escapes characters which would cause issues for HMTL.
    • the_title_rss()
    • get_the_date( $date_format, $post_ID ) / the_date( $date_format, $before, $after, $echo )
      • That the post was published, not the current moment in time.
    • the_date_xml()
    • get_the_time( $time_format, $post_ID ) / the_time( $time_format )
      • Of the post, not at this moment.
    • get_the_author() / the_author()
    • the_meta()
    • get_the_modified_date( $date_format ) / the_modified_date( $date_format, $before, $after, $echo )
    • get_the_modified_time( $time_format ) / the_modified_time( $time_format )
    • get_the_modified_author() / the_modified_author()
    • wp_link_pages( $args )
      • Used with nextpage().
  • Second Batch – Covers taxonomies.
    • category_description( $category_ID )
    • tag_description( $tag_ID )
    • term_description( $term_ID, $taxonomy )
    • single_cat_title( $prefix, $echo )
      • Displays the title of a single category, use on archive pages.
    • single_tag_title( $prefix, $echo )
    • single_term_title( $prefix, $echo )
    • get_the_category_list( $separator, $parents, $post_ID ) / the_category( $separator, $parents, $post_ID )
      • Categories associated with a particular post/page.
    • get_the_category_rss( $feed_type ) / the_category_rss( $feed_type )
    • get_the_tag_list( $before, $sep, $after ) / the_tags( $before, $sep, $after )
    • get_the_term_list( $post_ID, $taxonomy, $before, $sep, $after ) / the_terms( $post_ID, $taxonomy, $before, $sep, $after )
    • the_taxonomies( $args )
    • get_edit_tag_link( $tag_ID, $taxonomy ) / edit_tag_link( $link, $before, $after, $tag )
    • wp_list_categories( $args )
    • wp_dropdown_categories( $args )
    • wp_tag_cloud( $args )
    • wp_generate_tag_cloud( $tags, $args )
  • Third Batch – Covers comments.
    • get_comment_author( $comment_ID ) / comment_author( $comment_ID )
    • get_comment_author_rss() / comment_author_rss()
    • get_comment_author_email( $comment_ID ) / comment_author_email( $comment_ID )
    • get_comment_author_email_link( $linktext, $before, $after ) / comment_author_email_link( $linktext, $before, $after )
    • get_comment_author_url( $comment_ID ) / comment_author_url( $comment_ID )
    • get_comment_author_link( $comment_ID ) / comment_author_link( $comment_ID )
    • get_comment_author_url_link( $linktext, $before, $after ) / comment_author_url_link( $linktext, $before, $after )
    • get_comment_author_IP( $comment_ID ) / comment_author_IP( $comment_ID )
    • get_comment_text( $comment_ID ) / comment_text( $comment_ID ) *
    • comment_text_rss()
    • get_comment_excerpt( $comment_ID ) / comment_excerpt( $comment_ID )
    • get_comment_date( $date_format, $comment_ID ) / comment_date( $date_format, $comment_ID )
    • get_comment_time( $time_format, $gmt, $translate ) / comment_time( $time_format )
    • get_comment_ID() / comment_ID()
    • comment_type( $commenttext, $trackbacktxt, $pingbacktxt )
    • get_avatar( $id_or_email, $size, $default, $alt )
  • Fourth Batch – Covers comments.
    • get_comments_link( $post_ID ) / comments_link()
    • wp_list_comments( $args, $comments )
    • get_comments_number( $post_ID ) / comments_number( $zero, $one, $more )
    • get_comment_class( $class, $comment_ID, $post_ID ) / comment_class( $class, $comment_ID, $post_ID, $echo )
    • comment_form( $args, $post_ID )
    • comment_form_title( $noreplytext, $replytext, $linktoparent )
    • get_comment_reply_link( $args, $comment_ID, $post_ID ) / comment_reply_link( $args, $comment_ID, $post_ID )
    • get_comment_id_fields( $post_ID ) / comment_id_fields( $post_ID )
    • get_cancel_comment_reply_link( $text ) / cancel_comment_reply_link( $text )
    • get_next_comments_link( $label, $max_page ) / next_comments_link( $label, $max_page )
    • get_previous_comments_link( $label ) / previous_comments_link( $label )
    • paginate_comments_links( $args )
    • get_edit_comment_link( $comment_ID ) / edit_comment_link( $text, $before, $after )
    • get_post_comments_feed_link( $post_ID, $feed ) / post_comments_feed_link( $link_text, $post_ID, $feed )
    • comments_popup_link( $zero, $one, $more, $css_class, $none )
    • comments_popup_script( $width, $height, $file )
  • Fifth Batch – Covers more related to posts as well as covering templates.
    • get_post_class( $class, $post_ID ) / post_class( $class, $post_ID )
    • get_permalink( $post_ID, $leavename ) / the_permalink()
    • get_the_ID() / the_ID()
    • single_post_title( $prefix, $echo )
    • get_next_post_link( $format, $link, $in_same_term, $excluded_terms, $taxonomy ) / next_post_link( $format, $link, $in_same_term, $excluded_terms, $taxonomy )
    • get_previous_post_link( $format, $link, $in_same_term, $excluded_terms, $taxonomy ) / previous_post_link( $format, $link, $in_same_term, $excluded_terms, $taxonomy )
    • get_page_link( $post_ID, $leavename, $sample )
    • get_post_permalink( $post_ID, $leavename, $sample) / post_permalink( $post_ID )
    • wp_get_shortlink( $ID, $context, $allow_slugs ) / the_shortlink( $text, $title, $before, $after )
    • get_edit_post_link( $post_ID, $context ) / edit_post_link( $text, $before, $after, $post_ID )
    • get_delete_post_link( $post_ID, $deprecated, $force_delete )
    • permalink_anchor( $mode )
    • get_header( $name ) **
    • get_footer( $name ) **
    • get_sidebar( $name ) **
    • get_template_part( $slug, $name ) **
  • Sixth Batch – Covers author, users, and media.
    • get_authors_posts_url( $author_ID, $author_nicename )
    • the_author_posts_link()
    • get_the_author_link() / the_author_link()
    • get_the_author_meta( $field, $user_ID ) / the_author_meta( $field, $user_ID )
    • get_the_author_posts() / the_author_posts()
    • wp_list_authors( $args )
    • wp_dropdown_users( $args )
    • get_the_post_thumbnail( $post_ID, $size, $attr ) / the_post_thumbnail( $size, $attr )
    • wp_get_attachment_link( $post_ID, $size, $permalink, $icon, $text ) / the_attachment_link( $post_ID, $fullsize, $deprecated, $permalink )
    • get_post_thumbnail_id( $post_ID )
    • wp_get_attachment_image( $attachment_ID, $size, $icon, $attr )
    • wp_get_attachment_image_src( $attachment_ID, $size, $icon )
    • wp_get_attachment_metadata( $attachment_ID, $unfiltered )
    • next_image_link( $size, $text )
    • previous_image_link( $size, $text )
  • Seventh Batch – Covers some navigation relating to posts, archives, search, and user session.
    • get_archives_link( $url, $text, $format, $before, $after )
    • wp_get_archives( $args )
    • post_type_archive_title( $prefix, $echo )
    • single_month_title( $prefix, $echo )
    • get_next_posts_link( $label, $max_page ) / next_posts_link( $label, $max_page )
    • get_previous_posts_link( $label ) / previous_posts_link( $label )
    • get_posts_nav_link( $args ) / posts_nav_link( $sep, $prelabel, $nxtlabel )
    • get_search_form( $echo )
    • get_search_query( $escaped ) / the_search_query()
    • get_search_link( $query )
    • wp_register( $before, $after, $echo )
    • wp_login_form( $args )
    • wp_login_logout( $redirect, $echo )
    • wp_login_url( $redirect, $force_reauth )
    • wp_logout_url( $redirect )
    • wp_lostpassword_url( $redirect )
  • Eighth Batch – Covers bookmarks (skipped below), some general, and miscellaneous.
    • get_bloginfo( $show, $filter ) / bloginfo( $show )
    • get_body_class( $class ) / body_class( $class )
    • wp_nav_menu( $args )
    • wp_title( $sep, $echo, $seplocation )
    • get_home_url( $blog_id, $path, $scheme ) / home_url( $path, $scheme )
    • get_site_url( $blog_id, $path, $scheme ) / site_url( $path, $scheme )
    • get_current_blog_id()
    • get_admin_url( $blog_ID, $path, $scheme ) / admin_url( $path, $scheme )
    • get_feed_link( $feed_type ) / the_feed_link( $anchor, $feed_type )
    • user_trailingslashit( $string )
    • calendar_week_mod( $number )
    • get_calendar( $initial, $echo )
  • Series Finale – Summarizes what was learned in the series.