WordPress V2.xTemplate Tag Reference Guide as of Version 2.x
Presented by:
Post Tags
Post IDthe_ID();
Displays the numeric ID of the current post.
<?php the_ID(); ?>
No Parameters.
Post Titlethe_title();
Displays or returns the title of the current post.
<?php the_title(); ?>
before
Text to place before the title. Defaults to ''.
<?php the_title("before=»"); ?>
String
after
Text to place after the title. Defaults to ''.
<?php the_title("after=«"); ?>
String
display
Display the title (TRUE) or return it for use in PHP (FALSE).
<?php the_title("display=FALSE"); ?>
TRUE
FALSE
Post Title (Attribute)the_title_attribute();
Displays or returns the title of the current post. It somewhat duplicates the functionality of the_title(), but provides a 'clean' version of the title by stripping HTML tags and converting certain characters (including quotes) to their character entity equivalent.
<?php the_title_attribute('arguments'); ?>
before
Text to place before the title. Defaults to ''.
<?php the_title("before=»"); ?>
String
after
Text to place after the title. Defaults to ''.
<?php the_title("after=«"); ?>
String
echo
Display the title (1) or return it for use in PHP (0).
<?php the_title("echo=0"); ?>
1
0
Single Post Titlesingle_post_title();
Displays or returns the title of the post when on a single post page (permalink page).
<?php single_post_title('prefix', display); ?>
prefix
Text to place before the title. Defaults to ''.
<?php single_post_title('•', display); ?
String
display
Should the title be displayed (TRUE) or returned for use in PHP (FALSE).
<?php single_post_title('prefix', TRUE); ?
TRUE
FALSE
Post Title (RSS)the_title_rss();
Displays the title of the current post, formatted for RSS. This tag must be within The Loop.
<?php the_title_rss(); ?>
No Parameters.
Post Contentthe_content();
Displays the contents of the current post. This tag must be within The_Loop.
<?php the_content('more_link_text', strip_teaser, 'more_file'); ?>
more_link_text
The link text to display for the "more" link. Defaults to '(more...)'.
<?php the_content('More', strip_teaser, 'more_file'); ?>
String
strip_teaser
Should the text before the "more" link be hidden (TRUE) or displayed (FALSE).
<?php the_content('more_link_text', TRUE, 'more_file'); ?>
TRUE
FALSE
more_file
File the "more" link points to. Defaults to the current file.
<?php the_content('more_link_text', strip_teaser, 'more.php'); ?>
String
Post Content (RSS)the_content_rss();
Displays the content of the current post formatted for RSS. This tag must be within The_Loop.
<?php the_content_rss('more_link_text', strip_teaser, 'more_file'),cut, encode_html; ?>
more_link_text
The link text to display for the "more" link. Defaults to '(more...)'.
<?php the_content_rss('More', strip_teaser, 'more_file'),cut, encode_html; ?>
String
strip_teaser
Should the text before the "more" link be hidden (TRUE) or displayed (FALSE).
<?php the_content_rss('more_link_text', TRUE, 'more_file'),cut, encode_html; ?>
TRUE
FALSE
more_file
File the "more" link points to. Defaults to the current file.
<?php the_content_rss('more_link_text', strip_teaser, 'more.php'),cut, encode_html; ?>>
String
cut
Number of words displayed before ending content. Default is 0 (display all).
<?php the_content_rss('more_link_text', strip_teaser, 'more_file'),5, encode_html; ?>>
Integer
encode_html
Defines html tag filtering and special character (e.g. '&') encoding.
<?php the_content_rss('more_link_text', strip_teaser, 'more_file'),cut, 1; ?>>
0
1
2
Post Excerptthe_excerpt();
Displays the excerpt of the current post with [...] at the end, which is not a "read more" link. If you do not provide an explicit excerpt to a post (in the post editor's optional excerpt field), the first 55 words of the post's content are used. Also in the latter case, HTML tags and graphics are stripped from the excerpt's content. This tag must be within The Loop.
<?php the_excerpt(); ?>
No Parameters.
Post Excerpt (RSS)the_excerpt_rss();
Displays the excerpt of the current post formatted for RSS.If you do not provide an explicit excerpt to a post (in the post editor's optional excerpt field), the first 55 words of the post's content are used. This tag must be within The_Loop.
<?php the_excerpt_rss(); ?>
No Parameters.
Previous Post Linkprevious_post_link();
Used on single post permalink pages, this template tag displays a link to the previous post which exists in chronological order from the current post.
<?php previous_post_link('format', 'link', in_same_cat, 'excluded_categories'); ?>
format
Format string for the link. This is where to control what comes before and after the link. '%link' in string will be replaced with whatever is declared as 'link' (see next parameter). 'Go to %link' will generate "Go to <a href=..." Put HTML tags here to style the final results. Defaults to '« %link'.
<?php previous_post_link('Link: %link', 'link', in_same_cat, 'excluded_categories'); ?>
String
link
Link text to display. Defaults to previous post's title ('%title').
<?php previous_post_link('format', 'Previous Post', in_same_cat, 'excluded_categories'); ?>
String
in_same_cat
Indicates whether previous post must be within the same category as the current post. If set to TRUE, only posts from the current category will be displayed.
<?php previous_post_link('format', 'link', TRUE, 'excluded_categories'); ?>
TRUE
FALSE
excluded_categories
Numeric category ID(s) from which the previous post should not be listed. Separate multiple categories with and; example: '1 and 5 and 15'. There is no default.
<?php previous_post_link('format', 'link', in_same_cat, '2'); ?>
Integer
Next Post Linknext_post_link();
Used on single post permalink pages, this template tag displays a link to the next post which exists in chronological order from the current post.
<?php next_post_link('format', 'link', in_same_cat, 'excluded_categories'); ?>
format
Format string for the link. This is where to control what comes before and after the link. '%link' in string will be replaced with whatever is declared as 'link' (see next parameter). 'Go to %link' will generate "Go to <a href=..." Put HTML tags here to style the final results. Defaults to '« %link'.
<?php next_post_link('Link: %link', 'link', in_same_cat, 'excluded_categories'); ?>
String
link
Link text to display. Defaults to next post's title ('%title').
<?php next_post_link('format', 'Next Post', in_same_cat, 'excluded_categories'); ?>
String
in_same_cat
Indicates whether next post must be within the same category as the current post. If set to TRUE, only posts from the current category will be displayed.
<?php next_post_link('format', 'link', TRUE, 'excluded_categories'); ?>
TRUE
FALSE
excluded_categories
Numeric category ID(s) from which the next post should not be listed. Separate multiple categories with and; example: '1 and 5 and 15'. There is no default.
<?php next_post_link('format', 'link', in_same_cat, '2'); ?>
Integer
Post Nav Linksposts_nav_link();
Displays links for next and previous pages. Useful for providing "paged" navigation of index, category and archive pages.
<?php posts_nav_link('sep','prelabel','nxtlabel'); ?>
sep
Text displayed between the links.
<?php posts_nav_link(',','prelabel','nxtlabel'); ?>
String
prelabel
Link text for the previous page.
<?php posts_nav_link('sep','»','nxtlabel'); ?>
String
nxtlabel
Link text for the next page.
<?php posts_nav_link('sep','prelabel','«'); ?>
String
Post Metathe_meta();
Displays an unordered list of meta "key:value" pairs, or the post-meta, for the current post. Must be used from within The_Loop.
<?php the_meta(); ?>
No Parameters.
Post Tagsthe_tags();
Displays a link to the tag or tags a post belongs to. If no tags are associated with the current entry, the associated category is displayed instead. This tag should be used within The Loop.
<?php the_tags('before', 'separator', 'after'); ?>
before
Text to display before the actual tags are displayed. Defaults to Tags:
<?php the_tags('Post Tags:', 'separator', 'after'); ?>
String
seperator
Text or character to display between each tag link. The default is a comma (,) between each tag.
<?php the_tags('before', '|', 'after'); ?>
String
after
Text to display after the last tag. The default is to display nothing.
<?php the_tags('before', 'separator', '.'); ?>
String
Post Countwp_count_posts();
Returns the count of the rows in wp_posts that meet the post_type and post_status designated.
<?php wp_count_posts('type', 'status'); ?>
type
Type of row in wp_posts to count where type is equal to post_type.
<?php wp_count_posts('post', 'status'); ?>
post
page
status
Status of row in wp_posts to count where status is equal to post_status.
<?php wp_count_posts('type', 'draft'); ?>
published
draft