Skip to content
Jonathan Daggerhart edited this page Nov 28, 2015 · 1 revision

WordPress Template Tags

Template tags are core WordPress functions designed to be used by themes.

Codex: Template Tags

Post Tags

Tag | Description ---|---|--- the_title | the_title() - Echo the current post title. the_content | the_content() - Echo the current post content. the_excerpt | the_excerpt() - Echo the current post excerpt (summary). the_ID | the_ID() - Echo the current post ID. get_the_ID | get_the_ID() - Return the current post ID. the_permalink | the_permalink() - Echo the current post URL get_the_permalink | get_permalink() - Return the current post URL

Other Tags

Tag | Description ---|---|--- the_author | the_author() - Display the author's name. get_the_author_meta | get_the_author_meta('ID') - Get a piece of data about the current author. get_avatar | get_avatar( get_the_author_meta( 'ID' ), 32 ) - Display the current author's avatar image at a specific size. the_date | the_date() - Echo the current post's publish date. human_time_diff | human_time_diff( get_the_time('U'), current_time('timestamp') ) . ' ago' - Display how long ago the current post was published. the_tags | the_tags( 'Before:', '--string-between--', ':After' ); - Display the tags the current post has. the_category | the_category( '--string-between--' ); - Displays links to the category or categories the current post belongs to.

Featured Images (aka, post thumbnails)

Tag Usage Description
has_post_thumbnail has_post_thumbnail() Boolean whether or not the current post has a Featured Image.
the_post_thumbnail the_post_thumbnail('medium') Echo the Featured Image (also called the post thumbnail).
get_the_post_thumbnail get_the_post_thumbnail('medium') Return the Featured Image (also called the post thumbnail).