WordPress V2.XTemplate Tag Reference Guide

Author Template Tags

Author the_author();

<?php the_author(); ?>

No Parameters

The author of a post can be displayed by using this Template Tag. This tag must be used within The Loop.

Author Description the_author_description();

<?php the_author_description(); ?>

No Parameters

Displays the contents of the About yourself field in an author's Profile (Administration > Profile > Your Profile). About yourself is a block of text often used to publicly describe the user and can be quite long. This tag must be used within The Loop.

Author Login the_author_login();

<?php the_author_login(); ?>

No Parameters

This tag displays the login name for the author of a post. The login is also referred to as the Username an author uses to gain access to a WordPress blog. This tag must be used within The Loop.

Author First Name the_author_firstname();

<?php the_author_firstname(); ?>

No Parameters

This tag displays the first name for the author of a post. The First Name field is set in the user's profile (Administration > Profile > Your Profile). This tag must be used within The Loop.

Author Last Name the_author_lastname();

<?php the_author_lastname(); ?>

No Parameters

This tag displays the last name for the author of a post. The Last Name field is set in the user's profile (Administration > Profile > Your Profile). This tag must be used within The Loop.

Author Nickname the_author_nickname();

<?php the_author_nickname(); ?>

No Parameters

This tag displays the nickname for the author of a post. The Nickname field is set in the user's profile (Administration > Profile > Your Profile). This tag must be used within The Loop.

Author ID the_author_ID();

<?php the_author_ID(); ?>

No Parameters

Displays the unique numeric user ID for the author of a post; the ID is assigned by WordPress when a user account is created. This tag must be used within The Loop.

Author Emailthe_author_email();

<?php the_author_email(); ?>

No Parameters

This tag displays the email address for the author of a post. The E-mail field is set in the user's profile (Administration > Profile > Your Profile). This tag must be used within The Loop.

Author Website URLthe_author_url();

<?php the_author_url(); ?>

No Parameters

This tag displays the email address for the author of a post. The E-mail field is set in the user's profile (Administration > Profile > Your Profile). This tag must be used within The Loop.

Author Linkthe_author_link();

<?php the_author_link(); ?>

No Parameters

This tag displays a link to the Website for the author of a post. The Website field is set in the user's profile (Administration > Profile > Your Profile). The text for the link is the author's Profile Display name publicly as field. This tag must be used within The Loop.

Author AIM Screennamethe_author_aim();

<?php the_author_aim(); ?>

No Parameters

This tag displays the AOL Instant Messenger screenname for the author of a post. The AIM field is set in the user's profile (Administration > Profile > Your Profile). This tag must be used within The Loop.

Author Yahoo IM IDthe_author_yim();

<?php the_author_yim(); ?>

No Parameters

This tag displays the Yahoo IM ID for the author of a post. The Yahoo IM field is set in the user's profile (Administration > Profile > Your Profile). This tag must be used within The Loop.

Author Poststhe_author_posts();

<?php the_author_posts(); ?>

No Parameters

Displays the total number of posts an author has published. Drafts and private posts are not counted. This tag must be used within The Loop.

Author Posts Linkthe_author_posts_link();

<?php the_author_posts_link(); ?>

No Parameters

Displays a link to all posts by an author. The link text is the user's Display name publicly as field. The results of clicking on the presented link will be controlled by the Template Hierarchy of Author Templates. This tag must be used within The Loop

Author Listwp_list_authors();

<?php wp_list_authors('arguments'); ?>

Usage with Multiple Parameters
<?php wp_list_authors('exclude_admin=1&show_fullname=0'); ?>

optioncount

Display number of published posts by each author.

<?php wp_list_authors('optioncount=1'); ?>

1 (true)
0 (false)

exclude_admin

Exclude the 'admin' (login is admin) account from authors list.

<?php wp_list_authors('exclude_admin=0'); ?>>

1 (true)
0 (false)

show_fullname

Display the full (first and last) name of the authors. If false, the nickname is displayed.

<?php wp_list_authors('show_fullname=1'); ?>>

1 (true)
0 (false)

hide_empty

Do not display authors with 0 posts..

<?php wp_list_authors('hide_empty=0'); ?>

1 (true)
0 (false)

feed

Text to display for a link to each author's RSS feed. Default is no text, and no feed displayed.

<?php wp_list_authors('feed=RSS'); ?>

String

feed_image

Path/filename for a graphic. This acts as a link to each author's RSS feed, and overrides the feed parameter.

<?php wp_list_authors('feed_image=images/picture.jpg'); ?>>

String

Displays a list of the blog's authors (users), and if the user has authored any posts, the author name is displayed as a link to their posts. Optionally this tag displays each author's post count and RSS feed link.

Category Template Tags

Post Categorythe_category();

<?php the_category('arguments'); ?>

seperator

Text or character to display between each category link. The default is to place the links in an unordered list.

<?php the_category('seperator=&bull;'); ?>

String

parents

How to display links that reside in child (sub) categories.

<?php the_category('parents=multiple'); ?>

Single
Display link to child category only, with link text exhibiting "parent/child" relationship.
Multiple
Display separate links to parent and child categories, exhibiting "parent/child" relationship.

Displays a link to the category or categories a post belongs to. This tag must be used within The Loop.

Post Category in RSS Formatthe_category_rss();

<?php the_category_rss('arguments'); ?>

type

The type of feed to display to.

<?php the_category_rss('type=rss'); ?>

RSS
RDF

Displays the name of the category or categories a post belongs to in RSS format. This tag must be used within The Loop.

Page Category Titlesingle_cat_title();

<?php single_cat_title('prefix', 'display'); ?>

prefix

Text to output before the category title. Defaults to '' (no text).

<?php single_cat_title('&bull;','display'); ?>

String

display

Display the category's title

<?php single_cat_title('prefix','TRUE'); ?>

TRUE
FALSE

Displays or returns the category title for the current page. For pages displaying WordPress tags rather than categories (e.g. "/tag/geek") the name of the tag is displayed instead of the category.

Category Descriptioncategory_description();

<?php category_description(category); ?>

category

Returns the description of a category

<?php category_description('2'); ?>

Integer

Displays or returns the category title for the current page. For pages displaying WordPress tags rather than categories (e.g. "/tag/geek") the name of the tag is displayed instead of the category.

Category Dropdownwp_dropdown_categories('arguments');

<?php wp_dropdown_categories('arguments'); ?>

show_option_all

Causes the HTML for the dropdown to allow you to select All of the categories.

<?php wp_dropdown_categories('show_option_all='); ?>

String

show_option_none

Causes the HTML for the dropdown to allow you to select NONE of the categories.

<?php wp_dropdown_categories('show_option_none='); ?>

String

orderby

Key to sort options by.

<?php wp_dropdown_categories('orderby=name'); ?>

ID
name

order

Sort order for options.

<?php wp_dropdown_categories('order=DESC'); ?>

ASC
DESC

show_last_update

Sets whether to display the date of the last post in each category.

<?php wp_dropdown_categories('show_last_update=1'); ?>

1 (true)
0 (false)

show_count

Sets whether to display a count of posts in each category.

<?php wp_dropdown_categories('show_count=1'); ?>

1 (true)
0 (false)

hide_empty

Sets whether to hide (not display) categories with no posts.

<?php wp_dropdown_categories('hide_empty=0'); ?>

1 (true)
0 (false)

child_of

Only display categories that are children of the category identified by its ID. There is no default for this parameter.

<?php wp_dropdown_categories('child_of=5'); ?>

Integer

exclude

Comma separated list of category IDs to exclude. For example, 'exclude=4,12' means category IDs 4 and 12 will NOT be displayed/echoed or returned. Defaults to exclude nothing.

<?php wp_dropdown_categories('exclude=5'); ?>

Integer

echo

Display bookmarks (TRUE) or return them for use by PHP (FALSE).

<?php wp_dropdown_categories('echo=0'); ?>

1 (true)
0 (false)

selected

Category ID of the category to be 'selected' or presented in the display box. Defaults to no category selected.

<?php wp_dropdown_categories('selected=5'); ?>

Integer

heirarchial

Display categories in hierarchical fashion (child categories show indented).

<?php wp_dropdown_categories('heirarchial=1'); ?>

1 (true)
0 (false)

name

Name assigned to the dropdown form. Defaults to 'cat'.

<?php wp_dropdown_categories('name=cat-dropdown'); ?>

String

class

Class assinged to the dropdown form. Defaults to 'postform'.

<?php wp_dropdown_categories('class=cat-dropdown'); ?>

String

depth

This parameter controls how many levels in the hierarchy of Categories are to be included in the list of Categories.

<?php wp_dropdown_categories('depth=n'); ?>

0
All Categories and child Categories (Default).
-1
All Categories displayed in flat (no indent) form (overrides hierarchical).
1
Show only top level Categories
n
Value of n (some number) specifies the depth (or level) to descend in displaying Categories

Displays a list of categories in a select (i.e dropdown) box with no submit button.

Category Link Listwp_list_categories();

<?php wp_list_categories('arguments'); ?>

show_option_all

A non-blank values causes the display of a link to all categories if the style is set to list. The default value is not to display a link to all.

<?php wp_list_categories('show_option_all='); ?>

String

orderby

Sort categories alphabetically, by unique Category ID, or by the count of posts in that Category. The default is sort by category name.

<?php wp_list_categories('orderby=count'); ?>

ID
name
count

order

Sort order for categories (either ascending or descending).

<?php wp_list_categories('order=DESC'); ?>

ASC
DESC

show_last_updated

Should the last updated timestamp for posts be displayed (TRUE) or not (FALSE).

<?php wp_list_categories('show_last_updated=1'); ?>

1 (true)
0 (false)

style

Style to display the categories list in. A value of list displays the categories as list items while none generates no special display method (the list items are separated by tags).

<?php wp_list_categories('style=none'); ?>

List
None

show_count

Toggles the display of the current count of posts in each category.

<?php wp_list_categories('show_count=1'); ?>

1 (true)
0 (false)

hide_empty

Toggles the display of categories with no posts.

<?php wp_list_categories('hide_empty=0'); ?>

1 (true)
0 (false)

use_desc_for_title

Sets whether a category's description is inserted into the title attribute of the links created

<?php wp_list_categories('use_desc_for_title=0'); ?>

1 (true)
0 (false)

child_of

Only display categories that are children of the category identified by this parameter. There is no default for this parameter. If the parameter is used, the hide_empty parameter is set to false.

<?php wp_list_categories('child_of=5'); ?>

Integer

feed

Display a link to each category's rss-2 feed and set the link text to display. The default is no text and no feed displayed.

<?php wp_list_categories('feed=RSS'); ?>

String

feed_image

Set a URI for an image (usually an rss feed icon) to act as a link to each categories' rss-2 feed. This parameter overrides the feed parameter. There is no default for this parameter.

<?php wp_list_categories('feed_images=images/picture.jpg'); ?>

String

exclude

Exclude one or more categories from the results. This parameter takes a comma-separated list of categories by unique ID, in ascending order.

<?php wp_list_categories('exclude=5'); ?>

Integer

include

Only include the categories detailed in a comma-separated list by unique ID, in ascending order.

<?php wp_list_categories('include=5'); ?>

Integer

heirarchial

Display sub-categories as inner list items (below the parent list item) or inline.

<?php wp_list_categories('heirarchial=0'); ?>

1 (true)
0 (false)

title_li

Set the title and style of the outer list item. Defaults to "_Categories". If present but empty, the outer list item will not be displayed.

<?php wp_list_categories('titleli=_cats'); ?>

String

number

Sets the number of Categories to display. This causes the SQL LIMIT value to be defined. Default to no LIMIT.

<?php wp_list_categories('number=7'); ?>

Integer

echo

Show the result or keep it in a variable.

<?php wp_list_categories('echo=0'); ?>

1 (true)
0 (false)

depth

This parameter controls how many levels in the hierarchy of Categories are to be included in the list of Categories.

<?php wp_dropdown_categories('depth=n'); ?>

0
All Categories and child Categories (Default).
-1
All Categories displayed in flat (no indent) form (overrides hierarchical).
1
Show only top level Categories
n
Value of n (some number) specifies the depth (or level) to descend in displaying Categories

The template tag, wp_list_categories, displays a list of Categories as links. When a Category link is clicked, all the posts in that Category will display on a Category Page using the appropriate Category Template dictated by the Template Hierarchy rules.

If In Categoryin_category();

<?php if ( in_category('category_id') ): ?>
// Some category specific PHP/HTML here
<?php endif; ?>

category_id

The category ID of the category for which you wish to test. The parameter may either be passed as a bare integer or as a string

<?php if (in_category('6')): ?>
// Some category specific PHP/HTML here
<?php endif; ?>

Integer

Returns true if the current post is in the specified Category. Normally this tag is used within The Loop, but the $post variable must be set when using this tag outside of the loop.

Category's Parents Listget_category_parents();

<?php echo(get_category_parents(category, display link, separator, nice name)); ?>

category

The numeric category ID for which to return the parents. Defaults to current category, if one is set.

<?php echo(get_category_parents(3, display link, separator, nice name)); ?>

Integer

display link

Creates a link to each category displayed.

<?php echo(get_category_parents(category, TRUE, separator, nice name)); ?>

TRUE
FALSE

seperator

What to separate each category by.

<?php echo(get_category_parents(category, display link, &;bull;, nice name)); ?>

Integer

nice name

Return category nice name or not

<?php echo(get_category_parents(category, display link, seperator, TRUE)); ?>

TRUE
FALSE

Returns a list of the parents of a category, including the category, sorted by ID.

Category Arrayget_the_category();

<?php foreach((get_the_category()) as $category) {
     echo $category->cat_name . ' ';
     }
?>

Member Variables
VariableDescription

cat_ID

the category id (also stored as 'term_id')

cat_name

the category name (also stored as 'name')

category_nicename

a slug generated from the category name (also stored as 'slug')

category_description

the category description (also stored as 'description')

category_parent

the category id of the current category's parent. '0' for no parents. (also stored as 'parent')

category_count

the number of uses of this category (also stored as 'count')

Returns an array of objects, one object for each category assigned to the post. This tag must be used within The Loop.

Comment Template Tags

Comment Countcomments_number();

<?php comments_number('zero', 'one', 'more', 'number'); ?>

zero

Text to be displayed if there is no comments

<?php comments_number('No Comments', 'one', 'more', 'number'); ?>

String

one

Text to be displayed if there is 1 comment

<?php comments_number('zero', '1 Comment', 'more', 'number'); ?>

String

more

Text to be displayed if there more than 1 comment. % is replaced by the number of comments, so '% so far' is displayed as "5 so far" when there are five comments.

<?php comments_number('zero', 'one', '% Comments', 'number'); ?>

String

number

Number of comments. Defaults to the total actual number of comments

<?php comments_number('zero', 'one', 'more', '5'); ?>

Integer

Displays the total number of comments, Trackbacks, and Pingbacks for a post. This tag must be within The Loop.

Link to Post Commentscomments_link();

<?php comments_link(); ?>

No Parameters

Displays the URL to a post's comments. This tag must be within The Loop, or the loop set up for comments.

Link to RSS Feed of Post Commentscomments_rss_link();

<?php comments_rss_link('text', 'file'); ?>

text

Link text for the comments RSS link. Defaults to 'Comments RSS'

<?php comments_rss_link('RSS', 'file'); ?>

String

file

The file the link points to. Defaults to 'wp-commentsrss2.php'.

<?php comments_rss_link('text', 'wp-commentsrss2.php'); ?>

String

Much like an RSS feed for your WordPress blog, this feature will display a link to the RSS feed for a given post's comments. By implementing the feature, your readers will be able to track the comment thread for a given post, perhaps encouraging them to stay connected to the conversation.

JavaScript for Pop-Up Windowcomments_popup_script();

<?php comments_popup_script(width, height); ?>

width

The width of the popup window. Defaults to 400 (pixels).

<?php comments_popup_script(300, height); ?>

Integer

height

The height of the popup window. Defaults to 400 (pixels).

<?php comments_popup_script(width, 300); ?>

Integer

Outputs the JavaScript code for a comments popup window. Used in tandem with comments_popup_link(), this tag can be used anywhere within a template, though is typically placed within the <head> portion of a page.

Link to Pop-Up Windowcomments_popup_script();

<?php comments_popup_link ('zero','one','more','CSSclass','none'); ?>

zero

Text to display if there is no comments.

<?php comments_popup_link ('No Comments','one','more','CSSclass'); ?>

String

one

Text to display if there is one comment.

<?php comments_popup_link ('zero','1 Comment','more','CSSclass'); ?>

String

more

Text to dislay if there is more than one comment.

<?php comments_popup_link ('zero','one','% Comments','CSSclass'); ?>

String

CSSclass

CSS (stylesheet) class for the link. This has no default value.

<?php comments_popup_link ('zero','one','more','popup-link'); ?>

String

none

Comments off.

<?php comments_popup_link ('none'); ?>

String

Displays a link to the comments popup window if comments_popup_script() is used, otherwise it displays a normal link to comments. This tag must be within The Loop, or a comment loop, and it does nothing if is_single() or is_page() is true (even when within The Loop).

Comment IDcomment_ID();

<?php comment_ID(); ?>

No Parameters

Displays the numeric ID of a comment. This tag must be within The Loop, or a comment loop.

Author of Commentcomment_author();

<?php comment_author(); ?>

No Parameters

Displays the comment author name; that is, the one supplied by the commenter. If no name is provided (and "User must fill out name and email" is not enabled under Discussion Options), WordPress will assign "Anonymous" as comment author. This tag must be within The Loop, or a comment loop.

IP Address of Comment Authorcomment_author_IP();

<?php comment_author_IP(); ?>

No Parameters

Displays the comment author's IP address. This tag must be within The Loop, or a comment loop.

Email of Comment Authorcomment_author_email();

<?php comment_author_email(); ?>

No Parameters

Displays the comment author's email address, not linked. An email address must be provided if "User must fill out name and email" is enabled under Discussion Options. This tag must be within The Loop, or a comment loop.

Website URL of Comment Authorcomment_author_url();

<?php comment_author_url(); ?>

No Parameters

Displays the comment author's URL (usually their web site), not linked. This tag must be within The Loop, or a comment loop.

Mailto Link to Comment Authorcomment_author_email_link();

<?php comment_author_email_link('linktext', 'before', 'after'); ?>

linktext

Link text for the email link. Default is the comment author's email address.

<?php comment_author_email_link('Email', 'before', 'after'); ?>

String

before

Text to display before the link. There is no default.

<?php comment_author_email_link('linktext', '&raquo;', 'after'); ?>

String

after

Text to display after the link. There is no default.

<?php comment_author_email_link('linktext', 'before', '&laquo;'); ?>

String

Displays the comment author's email address, as a mailto link. An email address must be provided if "User must fill out name and email" is enabled under Discussion Options. This tag must be within The Loop, or a comment loop.

Link to Website URL of Comment Authorcomment_author_link();

<?php comment_author_link(); ?>

No Parameters

Displays the comment author's name linked to his/her URL, if one was provided. This tag must be within The Loop, or a comment loop.

Type of Commentcomment_type();

<?php comment_type('comment', 'trackback', 'pingback'); ?>

comment

Text to describe a comment type comment. Defaults to 'Comment'

<?php comment_type('Comment!', 'trackback', 'pingback'); ?>

String

trackback

Text to describe a Trackback type comment. Defaults to 'Trackback'.

<?php comment_type('comment', 'Trackback!', 'pingback'); ?>

String

pingback

Text to describe a Pingback type comment. Defaults to 'Pingback'.

<?php comment_type('comment', 'trackback', 'Pingback!'); ?>

String

Displays the type of comment (regular comment, Trackback or Pingback) a comment entry is. This tag must be within The Loop, or a comment loop.

Comment Textcomment_text();

<?php comment_text(); ?>

No Parameters

Displays the text of a comment. This tag must be within The Loop, or a comment loop.

Comment Excerptcomment_excerpt();

<?php comment_excerpt(); ?>

No Parameters

Displays an excerpt (maximum of 20 words) of a comment's text. This tag will work within a comment loop.

Date of Commentcomment_date();

<?php comment_date(); ?>

d

Formatting for the date. Defaults to the date format set in WordPress.

<?php comment_date('n-j-Y'); ?>

String

Displays the date a comment was posted. This tag must be within The Loop, or a comment loop.

Time of Commentcomment_time();

<?php comment_time(); ?>

d

Formatting for the time. Defaults to the time format set in WordPress.

<?php comment_time('H:i:s'); ?>

String

Displays the time a comment was posted. This tag must be within The Loop, or a comment loop.

Comment Author's Name Formatted for RSScomment_author_rss();

<?php comment_author_rss(); ?>

No Parameters

Displays the comment author's name formatted for RSS. Typically used in the RSS comment feed template. This tag must be within The Loop, or a comment loop.

Comment Text Formatted for RSScomment_text_rss();

<?php comment_text_rss(); ?>

No Parameters

Displays the text of a comment formatted for RSS. Typically used in the RSS comment feed template. This tag must be within The Loop, or a comment loop.

Comment Link Formatted for RSScomment_link_rss();

<?php comment_link_rss(); ?>

No Parameters

Displays the URL to an entry's comments formatted for RSS. Typically used in the RSS comment feed template. This tag must be within The Loop, or a comment loop.

Comment Permalink Formatted for RSSpermalink_comments_rss();

<?php permalink_comments_rss(); ?>

No Parameters

Displays the permalink to the post to which a comment belongs, formatted for RSS. Typically used in the RSS comment feed template. This tag must be within The Loop, or a comment loop.

Date & Time Template Tags

Post Date (xml)the_date_xml();

<?php the_date_xml(); ?>

No Parameters

Displays the date of the post in YYYY-MM-DD format (ex: 2004-09-24). This tag must be used within The Loop.

Post Datethe_date();

<?php the_date('format', 'before', 'after', echo); ?>>

format

The format for the date. Defaults to the date format configured in your WordPress options.

<?php the_date('n-j-Y', 'before', 'after', echo); ?>

String

before

Text to place before the date. There is no default.

<?php the_date('format', '&raquo', 'after', echo); ?>

String

after

Text to place after the date. There is no default.

<?php the_date('format', 'before', '&laquo', echo); ?>

String

echo

Display the date (TRUE), or return the date to be used in PHP (FALSE).

<?php the_date('format', 'before', 'after', TRUE); ?>

TRUE
FALSE

Displays or returns the date of a post, or a set of posts if published on the same day. This tag must be used within the Loop.

Post Timethe_time();

<?php the_time('d'); ?>

d

Formatting for the time. Defaults to the time format set in WordPress.

<?php the_time('H:i:s'); ?>

String

Displays the time of the current post. This tag must be used within The Loop.

Date (and Time) of Last Modification to Postthe_modified_date();

<?php the_modified_date('d'); ?>

d

Formatting for the date to display in. Defaults to the date format set in WordPress.

<?php the_modified_date('n-j-Y'); ?>

String

This tag displays the date (and time) a post was last modified. This tag works just like the_modified_time(), which also displays the time/date a post was last modified. This tag must be used within The Loop. If no format parameter is specified, the Default date format (please note that says Date format) setting from Administration > Options > General is used for the display format.

Time (and Date) of Last Modification to Postthe_modified_time();

<?php the_modified_time('d'); ?>

d

Formatting for the time to display in. Defaults to the date format set in WordPress.

<?php the_modified_time('H:i:s'); ?>

String

This tag displays the time (and date) a post was last modified and is similar to the functionality of the_time(), which displays the time (and date) a post was created. This tag must be used within The Loop. If no format parameter is specified, the Default date format (please note that says Date format) setting from Administration > Options > General is used for the display format.

Post Time (PHP)get_the_time();

<?php get_the_time('format'); ?>

format

The format the time is to display in. Defaults to the time format configured in your WordPress options.

<?php get_the_time(); ?>

String

Returns the time of the current post for use in PHP. It does not display the time. This tag must be used within The Loop.

Current Page Month & Year Titlesingle_month_title();

<?php single_month_title('prefix', display) ?>

prefix

Text to place before the title. There is no default.

<?php single_month_title('&bull', display) ?>

String

display

Display the title (TRUE), or return the title to be used in PHP (FALSE).

<?php single_month_title('prefix', FALSE) ?>

TRUE
FALSE

Displays or returns the month and year title for the current page. This tag only works when the m or archive month argument has been passed by WordPress to the current page (this occurs when viewing a monthly archive page). Note: This tag only works on date archive pages, not on category templates or others.

Post Calendarget_calendar();

<?php get_calendar(); ?>

initial

If true, the day will be displayed using a one-letter initial; if false, an abbreviation based on your localization will be used.

<?php get_calendar(false); ?>

true
causes Sunday to be "S"
false
causes "Sunday" to be displayed as "Sun"

Returns the time of the current post for use in PHP. It does not display the time. This tag must be used within The Loop.

General Template Tags

Blog Infobloginfo();

<?php bloginfo('arguments'); ?>

name

Weblog title; set in General Options. (Default)

<?php bloginfo('name'); ?>

Argument

description

Tagline for your blog; set in General Options.

<?php bloginfo('description'); ?>

Argument

url

URL for your blog's web site address.

<?php bloginfo('url'); ?>

Argument

rdf_url

URL for RDF/RSS 1.0 feed.

<?php bloginfo('rdf_url'); ?>

Argument

rss_url

URL for RSS 0.92 feed.

<?php bloginfo('rss_url'); ?>

Argument

rss2_url

URL for RSS 2.0 feed.

<?php bloginfo('rss2_url'); ?>

Argument

atom_url

URL for Atom feed.

<?php bloginfo('atom_url'); ?>

Argument

comments_rss2_url

URL for comments RSS 2.0 feed.

<?php bloginfo('comments_rss2_url'); ?>

Argument

pingback_url

URL for Pingback (XML-RPC file).

<?php bloginfo('pingback_url'); ?>

Argument

admin_email

Administrator's email address; set in General Options.

<?php bloginfo('admin_email'); ?>

Argument

charset

Character encoding for your blog; set in Reading Options.

<?php bloginfo('charset'); ?>

Argument

version

Version of WordPress your blog uses.

<?php bloginfo('version'); ?>

Argument

html_type

"Content-type" for your blog.

<?php bloginfo('html_type'); ?>

Argument

wpurl

URL for WordPress installation.

<?php bloginfo('wpurl'); ?>

Argument

template_url

URL for template in use.

<?php bloginfo('template_url'); ?>

Argument

template_directory

URL for template's directory.

<?php bloginfo('template_directory'); ?>

Argument

stylesheet_url

URL for primary CSS file. Returns: http//example.com/wp-content/themes/ + your-active-theme-name(value from wp_options, "stylesheet" row) + "/style.css"(hardcoded in functions.php)

<?php bloginfo('stylesheet_url'); ?>

Argument

Displays information about your blog, mostly gathered from the information you supply in your User Profile and General Options from the WordPress Administration panels. It can be used anywhere within a page template. This always prints a result to the browser. If you need the values for use in PHP, use get_bloginfo().

Blog Info RSSbloginfo_rss();

<?php bloginfo_rss('arguments'); ?>

name

Weblog title; set in General Options. (Default)

<?php bloginfo('name'); ?>

Argument

description

Tagline for your blog; set in General Options.

<?php bloginfo('description'); ?>

Argument

url

URL for your blog's web site address.

<?php bloginfo('url'); ?>

Argument

rdf_url

URL for RDF/RSS 1.0 feed.

<?php bloginfo('rdf_url'); ?>

Argument

rss_url

URL for RSS 0.92 feed.

<?php bloginfo('rss_url'); ?>

Argument

rss2_url

URL for RSS 2.0 feed.

<?php bloginfo('rss2_url'); ?>

Argument

atom_url

URL for Atom feed.

<?php bloginfo('atom_url'); ?>

Argument

comments_rss2_url

URL for comments RSS 2.0 feed.

<?php bloginfo('comments_rss2_url'); ?>

Argument

pingback_url

URL for Pingback (XML-RPC file).

<?php bloginfo('pingback_url'); ?>

Argument

admin_email

Administrator's email address; set in General Options.

<?php bloginfo('admin_email'); ?>

Argument

charset

Character encoding for your blog; set in Reading Options.

<?php bloginfo('charset'); ?>

Argument

version

Version of WordPress your blog uses.

<?php bloginfo('version'); ?>

Argument

html_type

"Content-type" for your blog.

<?php bloginfo('html_type'); ?>

Argument

wpurl

URL for WordPress installation.

<?php bloginfo('wpurl'); ?>

Argument

template_url

URL for template in use.

<?php bloginfo('template_url'); ?>

Argument

template_directory

URL for template's directory.

<?php bloginfo('template_directory'); ?>

Argument

stylesheet_url

URL for primary CSS file. Returns: http//example.com/wp-content/themes/ + your-active-theme-name(value from wp_options, "stylesheet" row) + "/style.css"(hardcoded in functions.php)

<?php bloginfo('stylesheet_url'); ?>

Argument

Displays information about your blog, mostly gathered from the information you supply in your User Profile and General Options from the WordPress Administration panels. This function is identical to bloginfo() except it strips any markup from the output for use in WordPress' syndication feeds.

Blog Info (PHP)get_bloginfo();

<?php get_bloginfo('arguments'); ?>

name

Default, returns the Weblog title set in Administration > Options > General. This data is retrieved from the blogname record in the wp_options table.

<?php get_bloginfo('name'); ?>

Argument

description

the Tagline set in Administration > Options > General. This data is retrieved from the blogdescription record in the wp_options table.

<?php get_bloginfo('description'); ?>

Argument

url

Displays the Blog address (URI) is the URL for your blog's web site address and is set in Administration > Options > General. This data is retrieved from the home record in the wp_options table.

<?php get_bloginfo('url'); ?>

Argument

home

Displays the Blog address (URI) is the URL for your blog's web site address and is set in Administration > Options > General. This data is retrieved from the home record in the wp_options table.

<?php get_bloginfo('home'); ?>

Argument

siteurl

Displays the Blog address (URI) is the URL for your blog's web site address and is set in Administration > Options > General. This data is retrieved from the home record in the wp_options table.

<?php get_bloginfo('siteurl'); ?>

Argument

wpurl

the WordPress address (URI) is the URL for your WordPress installation and is set in Administration > Settings > General. This data is retrieved from the siteurl record in the wp_options table.

<?php get_bloginfo('wpurl'); ?>

Argument

rdf_url

URL for RDF/RSS 1.0 feed which is your Blog address (URI) appended with the string such as /feed/rfd.

<?php get_bloginfo('rdf_url'); ?>

Argument

rss_url

URL for RSS 0.92 feed which is your Blog address (URI) appended with the string such as /feed/rss.

<?php get_bloginfo('rss_url'); ?>

Argument

rss2_url

URL for RSS 2.0 feed which is your Blog address (URI) appended with the string such as /feed/rss.

<?php get_bloginfo('rss2_url'); ?>

Argument

atom_url

URL for Atom feed which is your Blog address (URI) appended with the string such as /feed/rss.

<?php get_bloginfo('atom_url'); ?>

Argument

comments_rss2_url

URL for comments RSS 2.0 feed which is your Blog address (URI) appended with the string such as /comments/feed.

<?php get_bloginfo('comments_rss2_url'); ?>

Argument

pingback_url

URL for Pingback (XML-RPC file) which is your Blog address (URI) appended with the string /xmlrpc.php.

<?php get_bloginfo('pingback_url'); ?>

Argument

stylesheet_url

URL for primary CSS file which is your Blog address (URI) appended with the string composed of /wp-content/themes plus the value of the stylesheet record in the wp_options table plus the string /style.css.

<?php get_bloginfo('stylesheet_url'); ?>

Argument

stylesheet_directory

URL for stylesheet directory which is your Blog address (URI) appended with the string composed of /wp-content/themes plus the value of the stylesheet record in the wp_options table.

<?php get_bloginfo('stylesheet_directory'); ?>

Argument

template_directory

URL for template's directory which is your Blog address (URI) appended with the string composed of /wp-content/themes plus the value of the template record in the wp_options table.

<?php get_bloginfo('template_directory'); ?>

Argument

template_url

URL for template's directory which is your Blog address (URI) appended with the string composed of /wp-content/themes plus the value of the template record in the wp_options table.

<?php get_bloginfo('template_url'); ?>

Argument

admin_email

the Administrator's E-mail address set in Administration > Settings > General. This data is retrieved from the admin_email record in the wp_options table.

<?php get_bloginfo('admin_email'); ?>

Argument

charset

the Encoding for pages and feeds set in Administration > Settings > Reading. This data is retrieved from the blog_charset record in the wp_options table.

<?php get_bloginfo('charset'); ?>

Argument

version

Version of WordPress your blog uses. This data is the value of $wp_version variable set in wp-includes/version.php.

<?php get_bloginfo('version'); ?>

Argument

html_type

"Content-type" for your blog. This value is set in wp-admin/upgrade-schema.php and is retrieved from the html_type record in the wp_options table .

<?php get_bloginfo('html_type'); ?>

Argument

The get_bloginfo() Template Tag returns information about your blog which can then be used elsewhere in your PHP code. This Template Tag, as well as bloginfo(), can also be used to display your blog information.

Blog Info RSS (PHP)get_bloginfo_rss();

<?php get_bloginfo_rss('arguments'); ?>

name

Weblog title; set in General Options. (Default)

<?php get_bloginfo_rss('name'); ?>

Argument

description

Tagline for your blog; set in General Options.

<?php get_bloginfo_rss('description'); ?>

Argument

url

URL for your blog's web site address.

<?php get_bloginfo_rss('url'); ?>

Argument

rdf_url

URL for RDF/RSS 1.0 feed.

<?php get_bloginfo_rss('rdf_url'); ?>

Argument

rss_url

URL for RSS .92 feed.

<?php get_bloginfo_rss('rss_url'); ?>

Argument

rss2_url

URL for RSS 2.0 feed.

<?php get_bloginfo_rss('rss2_url'); ?>

Argument

atom_url

URL for Atom feed.

<?php get_bloginfo_rss('atom_url'); ?>

Argument

comments_rss2_url

URL for comments RSS 2.0 feed.

<?php get_bloginfo_rss('comments_rss2_url'); ?>

Argument

pingback_url

URL for Pingback (XML-RPC file).

<?php get_bloginfo_rss('pingback_url'); ?>

Argument

admin_email

Administrator's email address; set in General Options.

<?php get_bloginfo_rss('admin_email'); ?>

Argument

charset

Character encoding for your blog; set in Reading Options.

<?php get_bloginfo_rss('charset'); ?>

Argument

version

Version of WordPress your blog uses.

<?php get_bloginfo_rss('version'); ?>

Argument

html_type

"Content-type" for your blog.

<?php get_bloginfo_rss('html_type'); ?>

Argument

wpurl

"Content-type" for your blog.

<?php get_bloginfo_rss('html_type'); ?>

Argument

wpurl

"Content-type" for your blog.

<?php get_bloginfo_rss('html_type'); ?>

Argument

template_url

URL for template in use.

<?php get_bloginfo_rss('template_url'); ?>

Argument

template_directory

URL for template's directory.

<?php get_bloginfo_rss('template_directory'); ?>

Argument

stylesheet_url

URL for primary CSS file.

<?php get_bloginfo_rss('stylesheet_url'); ?>

Argument

stylesheet_directory

URL for stylesheet directory.

<?php get_bloginfo_rss('stylesheet_directory'); ?>

Argument

Returns information about your blog, which can then be used elsewhere in your PHP code. This function is identical to get_bloginfo() except it strips any markup from the output for use in WordPress' syndication feeds.

Page Titlewp_title();

<?php wp_title('sep', echo, 'seplocation'); ?>

sep

Text to display before or after of the post title (i.e. the separator). By default (if sep is blank) then the &raquo; (») symbol will be placed before or after (specified by the seplocation) the post title.

<?php wp_title('&bull;', echo, 'seplocation'); ?>

String

echo

Echo the title (True) or return the title for use as a PHP string (False).

<?php wp_title('sep', 1, 'seplocation'); ?>

1 (true)
0 (false)

seplocation

Introduced with Version 2.5, this parameter defines the location of where the sep string prints in relation to the title of the post.

<?php wp_title('sep', echo, 'right'); ?>

All Values Except 'right'
sep value is placed in front of (to the left of) the post title.
right
sep value is placed behind (to the right of) the post title.

Displays or returns the title of the page.

Get Postsget_posts;

<?php get_posts('arguments'); ?>

numberposts

Number of posts to return.

<?php get_posts('numberposts=10'); ?>

Integer (defaults to 5)

offset

Offset from latest post.

<?php get_posts('offset=1'); ?>

Integer (defaults to 0)

category

Only show posts from this category ID.

<?php get_posts('category=2'); ?>

Integer

orderby

Sort posts by one of various values

<?php get_posts('orderby=post_name'); ?>

post_title
Sort alphabetically by page or post title.
post_date
Sort by creation time.
post_modified
Sort by time last modified.
ID
Sort by numeric post ID.
post_author
Sort by the numeric IDs of authors.
post_name
Sort alphabetically by post slug.

order

How to sort 'orderby'.

<?php get_posts('order=DESC'); ?>

ASC
Ascending (lowest to highest).
DESC
Descending (highest to lowest).

include

The IDs of the posts you want to show, separated by commas and/or spaces.

<?php get_posts('include=62'); ?>

Integer

exclude

The IDs of any posts you want to exclude, separated by commas and/or spaces

<?php get_posts('exclude=62'); ?>

Integer

meta_key and meta_value

Only show posts that contain a meta (custom) field with this key and value. Both parameters must be defined, or neither will work.

<?php get_posts('meta_key=sport&meta_value=basketball'); ?>

String

post_type

The type of post to show.

<?php get_posts('post_type=page'); ?>

post
page
attachment
(blank)
all post types

post_status

Show posts with a particular status.

<?php get_posts('post_status=draft'); ?>

publish
private
draft
future
(blank)

post_parent

Show only the children of the post with this ID

<?php get_posts('post_parent=7'); ?>

Integer

This is a simple tag for creating multiple loops.

Archives Listwp_get_archives();

<?php wp_get_archives('arguments'); ?>

type

The type of archive list to display. Defaults to WordPress settings.

<?php wp_get_archives('type=yearly'); ?>

yearly
monthly
daily
weekly
postbypost

limit

Number of archives to get. Default is no limit.

<?php wp_get_archives('limit=5'); ?>

Integer

format

Format for the archive list.

<?php wp_get_archives('format=link'); ?>

html
In HTML list (<li>) tags and before and after strings.
option
In select (<select>) or dropdown option (<option>) tags.
link
Within link (<link>) tags.
custom
Custom list using the before and after strings.

before

Text to place before the link when using the html or custom for format option. There is no default.

<?php wp_get_archives('before=&raquo;'); ?>

String

after

Text to place after the link when using tge html or custom for format option. There is no default.

<?php wp_get_archives('after=&laquo;'); ?>

String

show_post_count

Display number of posts in an archive.

<?php wp_get_archives('show_post_count=1'); ?>

1 (true)
0 (false)

This function displays a date-based archives list.

Page Link Listwp_list_pages();

<?php wp_list_pages('arguments'); ?>

sort_column

Sorts the list of Pages in a number of different ways.

<?php wp_list_pages('sort_column=ID'); ?>

post_title
Sort Pages alphabetically (by title)
menu_order
Sort Pages by Page Order. N.B. Note the difference between Page Order and Page ID. The Page ID is a unique number assigned by WordPress to every post or page. The Page Order can be set by the user in the Write>Pages administrative panel.
post_date
Sort by creation time.
post_modified
Sort by time last modified.
ID
Sort by numeric Page ID.
post_author
Sort by the Page author's numeric ID.
post_name
Sort alphabetically by Post slug.

sort_order

Change the sort order of the list of Pages (either ascending or descending).

<?php wp_list_pages('sort_order=desc'); ?>

asc
Sort from lowest to highest
desc
Sort from highest to lowest.

exclude

Define a comma-separated list of Page IDs to be excluded from the list

<?php wp_list_pages('exclude=62'); ?>

Integer

include

Only include certain Pages in the list generated by wp_list_pages. Like exclude, this parameter takes a comma-separated list of Page IDs.

<?php wp_list_pages('include=62'); ?>

Integer

depth

This parameter controls how many levels in the hierarchy of pages are to be included in the list generated by wp_list_pages.

<?php wp_list_pages('depth=1'); ?>

0
Pages and sub-pages displayed in hierarchical (indented) form
-1
Pages in sub-pages displayed in flat (no indent) form.
1
Show only top level Pages
2
Value of 2 (or greater) specifies the depth (or level) to descend in displaying Pages.

child_of

Displays the sub-pages of a single Page only; uses the ID for a Page as the value.

<?php wp_list_pages('child_of=7'); ?>

Integer

show_date

Display creation or last modified date next to each Page. The default value is the null value (do not display dates).

<?php wp_list_pages('showdate=modified'); ?>

' '
Display no date.
modified
Display date of the last modified
xxx
Any value other than modified displays the date (post_date) the Page was first created.

date_format

Controls the format of the Page date set by the show_date parameter (example: "l, F j, Y"). This parameter defaults to the date format configured in your WordPress options.

<?php wp_list_pages('date_format=l, F j, Y'); ?>

String

title_li

Set the text and style of the Page list's heading.

<?php wp_list_pages('title_li=Page List'); ?>

String

echo

Toggles the display of the generated list of links or return the list as an HTML text string to be used in PHP.

<?php wp_list_pages('echo=0'); ?>

1 (true)
0 (false)

hierarchial

Display sub-Pages in an indented manner below their parent or list the Pages inline. The default is true (display sub-Pages indented below the parent list item).

<?php wp_list_pages('echo=0'); ?>

1 (true)
0 (false)

meta_key and meta_value

Only include the Pages that have this Custom Field Key and Value

<?php wp_list_pages('meta_key=sport&meta_value=basketball'); ?>

String

The Template Tag, wp_list_pages(), displays a list of WordPress Pages as links.

Page Dropdownwp_dropdown_pages();

<?php wp_dropdown_pages('arguments'); ?>

depth

This parameter controls how many levels in the hierarchy of pages are to be included in the list generated by wp_list_pages.

<?php wp_dropdown_pages('depth=1'); ?>

0
Pages and sub-pages displayed in hierarchical (indented) form.
-1
Pages in sub-pages displayed in flat (no indent) form.
1
Show only top level Pages.
n
Value of 2 (or greater) specifies the depth (or level) to descend in displaying Pages.

child_of

Displays the sub-pages of a single Page only; uses the ID for a Page as the value.

<?php wp_dropdown_pages('child_of=4'); ?>

Integer

selected

Page ID of the page to be 'selected' or presented in the display box. Defaults to no page selected.

<?php wp_dropdown_pages('selected=7'); ?>

Integer

echo

Toggles the display of the generated list of links or return the list as an HTML text string to be used in PHP. The default value is 1 (display the generated list items).

<?php wp_dropdown_pages('echo=0'); ?>

1 (true)
0 (false)

name

Name assigned to the dropdown form. Defaults to 'page_id'.

<?php wp_dropdown_pages('name=page-id'); ?>

String

show_option_none

Causes the HTML for the dropdown to allow you to select NONE of the pages.

<?php wp_dropdown_pages('show_option_none='); ?>

String

exclude

Comma separated list of category IDs to exclude.

<?php wp_dropdown_pages('exclude=7,3'); ?>

Integer(s)

Displays a list of pages in a select (i.e dropdown) box with no submit button.

Login/Logout Linkwp_loginout();

<?php wp_loginout(); ?>

No Parameters.

Displays a login link, or if a user is logged in, a logout link.

Register/Site Admin Linkwp_register();

<?php wp_register('before', 'after'); ?>

before

Text to display before the Register or Site Admin link. Default is '<li>'.

<?php wp_register('&raquo;', 'after'); ?>

String

after

Text to display after the Register or Site Admin link. Default is '</li>'.

<?php wp_register('before', '&laquo;'); ?>

String

This tag displays either the "Register" link to users that are not logged in or the "Site Admin" link if a user is logged in.

Query Postsquery_posts();

<?php query_posts('parameters'); ?>

cat

Display the posts from one or more category ID's.

<?php query_posts('cat=7'); ?>

Integer

category_name

Display posts with a certain category name.

<?php query_posts('category_name=Sports'); ?>

String

tag

Show posts associated with certain tags.

<?php query_posts('tag=basketball'); ?>

String

author_name

Show posts by an author with a certain name.

<?php query_posts('author_name=Chase'); ?>

String

author

Show posts by an author with a certain ID.

<?php query_posts('author=3'); ?>

Integer

p

Use the post ID to show the first post.

<?php query_posts('p=9'); ?>

Integer

name

Use the post slug to show the first post.

<?php query_posts('name=chase-crawford'); ?>

String

page_id

Show posts from a page with a certain ID.

<?php query_posts('page_id=11'); ?>

Integer

pagename

Show posts from this page with a certain name.

<?php query_posts('pagename=about'); ?>

String

showposts

Show a limited amount of posts.

<?php query_posts('showposts=11'); ?>

Integer

hour

Show post belonging to this hour.

<?php query_posts('hour=12'); ?>

Integer

minute

Show posts belonging to this minute.

<?php query_posts('minutes=33'); ?>

Integer

second

Show posts belonging to this second.

<?php query_posts('second=59'); ?>

Integer

day

Show posts belonging to this day.

<?php query_posts('day=14'); ?>

Integer

monthnum

Show posts belonging to this month.

<?php query_posts('monthnum=6'); ?>

Integer

year

Show posts belonging to this year.

<?php query_posts('year=2003'); ?>

Integer

paged

show the posts that would normally show up just on page 2 when using the "Older Entries" link.

<?php query_posts('paged=3'); ?>

Integer

posts_per_page

number of posts to show per page; a value of -1 will show all posts.

<?php query_posts('post_per_page=5'); ?>

Integer

order

What order to display posts in.

<?php query_posts('order=ASC'); ?>

ASC
DESC

offset

Displaces or passes over one or more initial posts which would normally be collected by your query.

<?php query_posts('offset=1'); ?>

Integer

orderby

Sort retrieved posts by this field.

<?php query_posts('orderby=title'); ?>

author
date
category
title
modified
menu_order
parent
ID
rand

Query_posts can be used to control which posts show up in The Loop. It accepts a variety of parameters in the same format as used in your URL.

RSS Enclosuresrss_enclosure();

<?php rss_enclosure(); ?>

No Parameters.

Transforms links to audio or video files in a post into RSS enclosures. Used for Podcasting.

Tag Cloudwp_tag_cloud();

<?php wp_tag_cloud(''); ?>

No Parameters.

Displays a list of tags in what is called a 'tag cloud', where the size of each tag is determined by how many times that particular tag has been assigned to posts.

Search Querythe_search_query();

<?php the_search_query(''); ?>

No Parameters.

Displays the search query for the current request, if a search was made.

Link Template Tags

'Edit Post' Linkedit_post_link();

<?php edit_post_link('link', 'before', 'after'); ?>

link

The link text. Defaults to 'Edit This'.

<?php edit_post_link('Edit', 'before', 'after'); ?>

String

before

Text to put before the link text. There is no default.

<?php edit_post_link('link', '&raquo;', 'after'); ?>

String

after

Text to put after the link text. There is no default.

<?php edit_post_link('link', 'before', '&laquo;'); ?>

String

Displays a link to edit the current post, if a user is logged in and allowed to edit the post.

'Edit Comment' Linkedit_comment_link();

<?php edit_comment_link('link', 'before', 'after'); ?>

link

The link text. Defaults to 'Edit This'.

<?php edit_post_link('Edit', 'before', 'after'); ?>

String

before

Text to put before the link text. There is no default.

<?php edit_post_link('link', '&raquo;', 'after'); ?>

String

after

Text to put after the link text. There is no default.

<?php edit_post_link('link', 'before', '&laquo;'); ?>

String

Displays a link to edit the current comment, if the user is logged in and allowed to edit the comment.

Page Linkswp_page_links();

<?php wp_page_links('arguments'); ?>

before

Text to put before all the links. Defaults to <p>Pages:

<?php wp_page_links('before=<div>'); ?>

String

after

Text to put after all the links. Defaults to </p>.

<?php wp_page_links('after=</div>'); ?>

String

next_or_number

Indicates whether page numbers should be used.

<?php wp_page_links('next_or_number=next'); ?>

number
next

nextpagelink

Text for link to next page. Defaults to Next page.

<?php wp_page_links('nextpagelink=Next'); ?>

String

previouspagelink

Text for link to previous page. Defaults to Previous page.

<?php wp_page_links('previouspagelink=Previous'); ?>

String

pagelink

Format string for page numbers. % in the string will be replaced with the number, so Page % would generate "Page 1", "Page 2", etc. Defaults to %.

<?php wp_page_links('pagelink=[%]'); ?>

String

more_file

Page the links should point to. Defaults to the current page.

<?php wp_page_links('more_file=more.php'); ?>

String

Displays page-links for paginated posts.

Yearly Archive URLget_year_link();

<?php get_year_link('year'); ?>

year

The year for the archive. Use '' to assign current year.

<?php get_year_link('2003'); ?>

Integer

Returns the yearly archive URL to a specific year for use in PHP. It does NOT display the URL. If year is set to '', the tag returns the URL for the current year's archive.

Monthly Archive URLget_month_link();

<?php get_month_link('year','month'); ?>

year

The year for the archive. Use '' to assign current year.

<?php get_month_link('2003','month'); ?>

Integer

month

The month for the archive. Use '' to assign current month.

<?php get_month_link('year','10'); ?>

Integer

Returns the monthly archive URL to a specific year and month for use in PHP. It does NOT display the URL. If year and month parameters are set to '', the tag returns the URL for the current month's archive.

Daily Archive URLget_day_link();

<?php get_day_link('year','month','day'); ?>

year

The year for the archive. Use '' to assign current year.

<?php get_day_link('2003','month','day'); ?>

Integer

month

The month for the archive. Use '' to assign current month.

<?php get_day_link('year','10','day'); ?>

Integer

day

The day for the archive. Use '' to assign current day.

<?php get_day_link('year','month','23'); ?>

Integer

Returns the monthly archive URL to a specific year and month for use in PHP. It does NOT display the URL. If year and month parameters are set to '', the tag returns the URL for the current month's archive.

Previous Post Linksnext_posts_link();

<?php next_posts_link('Label', 'Max number of pages (default 0)'); ?>

No Parameters.

This creates a link to the previous posts. Yes, it says "next posts," but it's named that just to confuse you.

Permalink Template Tags

Permalink Anchorpermalink_anchor();

<?php permalink_anchor('type'); ?>

type

Type of anchor to output.

<?php permalink_anchor('type=title'); ?>

id
Anchor equals numeric post ID.
title
Anchor equals postname, i.e. post slug.

Outputs a permalink anchor identifier or id (<a id="....) for a post.

Permalink (PHP)get_permalink();

<?php get_permalink(id); ?>

id

The numeric ID for a post. When this tag is used in The Loop without an id parameter value, tag defaults to the current post ID.

<?php get_permalink(17); ?>

Integer

Returns the permalink to a post for use in PHP. It does NOT display the permalink and can be used outside of The Loop.

Permalink URLthe_permalink();

<?php the_permalink(); ?>

No Parameters

Displays the URL for the permalink to the post currently being processed in The Loop. This tag must be within The Loop, and is generally used to display the permalink for each post, when the posts are being displayed.

Permalink (formatted for syndication feeds)permalink_single_rss();

<?php permalink_single_rss('file'); ?>

file

The page the link should point to. Defaults to the current page.

<?php permalink_single_rss('index.php'); ?>

String

Displays the URL for the permalink to the post currently being processed in The Loop. This tag must be within The Loop, and is generally used to display the permalink for each post, when the posts are being displayed.

Post Template Tags

Post IDthe_ID();

<?php the_ID(); ?>

No Parameters.

Displays the numeric ID of the current post.

Post Titlethe_title();

<?php the_title(); ?>

before

Text to place before the title. Defaults to ''.

<?php the_title("before=&raquo;"); ?>

String

after

Text to place after the title. Defaults to ''.

<?php the_title("after=&laquo"); ?>

String

display

Display the title (TRUE) or return it for use in PHP (FALSE).

<?php the_title("display=FALSE"); ?>

TRUE
Display the title.
FALSE
Return for use in PHP

Displays or returns the title of the current post.

Post Title (Attribute)the_title_attribute();

<?php the_title_attribute('arguments'); ?>

before

Text to place before the title. Defaults to ''.

<?php the_title("before=&raquo;"); ?>

String

after

Text to place after the title. Defaults to ''.

<?php the_title("after=&laquo"); ?>

String

echo

Display the title (1) or return it for use in PHP (0).

<?php the_title("echo=0"); ?>

1
Display the title.
0
Return for use in PHP

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.

Single Post Titlesingle_post_title();

<?php single_post_title('prefix', display); ?>

prefix

Text to place before the title. Defaults to ''.

<?php single_post_title('&bull;', display); ?

String

display

Should the title be displayed (TRUE) or returned for use in PHP (FALSE).

<?php single_post_title('prefix', TRUE); ?

TRUE
FALSE

Displays or returns the title of the post when on a single post page (permalink page).

Post Title (RSS)the_title_rss();

<?php the_title_rss(); ?>

No Parameters.

Displays the title of the current post, formatted for RSS. This tag must be within The Loop.

Post Contentthe_content();

<?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

Displays the contents of the current post. This tag must be within The_Loop.

Post Content (RSS)the_content_rss();

<?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
Parses out links for numbered "url footnotes".
1
Filters through the PHP function htmlspecialchars(), but also sets cut to 0, so is not recommended when using the cut parameter.
2
Strips html tags, and replaces '&' with HTML entity equivalent (&). This is the default when using the cut parameter.

Displays the content of the current post formatted for RSS. This tag must be within The_Loop.

Post Excerptthe_excerpt();

<?php the_excerpt(); ?>

No Parameters.

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.

Post Excerpt (RSS)the_excerpt_rss();

<?php the_excerpt_rss(); ?>

No Parameters.

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.

Previous Post Linkprevious_post_link();

<?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 '&laquo; %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

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.

Next Post Linknext_post_link();

<?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 '&laquo; %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

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.

Post Nav Linksposts_nav_link();

<?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','&raquo','nxtlabel'); ?>

String

nxtlabel

Link text for the next page.

<?php posts_nav_link('sep','prelabel','&laquo'); ?>

String

Displays links for next and previous pages. Useful for providing "paged" navigation of index, category and archive pages.

Post Metathe_meta();

<?php the_meta(); ?>

No Parameters.

Displays an unordered list of meta "key:value" pairs, or the post-meta, for the current post. Must be used from within The_Loop.

Post Tagsthe_tags();

<?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

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.

Post Countwp_count_posts();

<?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

Returns the count of the rows in wp_posts that meet the post_type and post_status designated.

Tag Template Tags

Tag Cloudwp_tag_cloud();

<?php wp_tag_cloud(); ?>

smallest

The text size of the tag with the smallest count value (units given by unit parameter).

<?php wp_tag_cloud(); ?>

Integer

largest

The text size of the tag with the highest count value (units given by the unit parameter).

<?php wp_tag_cloud(); ?>

Integer

unit

Unit of measure as pertains to the smallest and largest values. This can be any CSS length value, e.g. pt, px, em, %; default is pt (points).

<?php wp_tag_cloud(); ?>

String

number

The number of actual tags to display in the cloud. (Use '0' to display all tags.)

<?php wp_tag_cloud(); ?>

Integer

format

Format of the cloud display.

<?php wp_tag_cloud(); ?>

flat
tags are separated by whitespace
list
tags are in UL with a class='wp-tag-cloud'
array
tags are in an array and function returns the tag cloud as an array for use in PHP

orderby

Order of the tags.

<?php wp_tag_cloud(); ?>

name
count

order

Sort order.

<?php wp_tag_cloud(); ?>

ASC
DESC
RAND
Tags are in a random order.

exclude

Comma separated list of tags (term_id) to exclude. For example, 'exclude=5,27' means tags that have the term_id 5 or 27 will NOT be displayed. Defaults to exclude nothing.

<?php wp_tag_cloud(); ?>

String

include

Comma separated list of tags (term_id) to include. For example, 'include=5,27' means tags that have the term_id 5 or 27 will be the only tags displayed. Defaults to include everything.

<?php wp_tag_cloud(); ?>

String

Displays a list of tags in what is called a 'tag cloud', where the size of each tag is determined by how many times that particular tag has been assigned to posts.

Tag Arrayget_the_tags();

<?php get_the_tags(); ?>

Member Variables

term_id

the tag ID

name

the tag name

slug

a slug generated from the tag name

term_group

the group of the tag, if any

taxonomy

should always be 'post_tag' for this case

description

the tag description

count

number of uses of this tag, total

Returns an array of objects, one object for each tag assigned to the post. This tag must be used within The Loop..

Tag Listget_the_tag_list();

<?php get_the_tag_list(); ?>

No Parameters.

Generates a HTML string of the tags associated with the current post. The name of each tag will be linked to the relevant 'tag' page.

Tag Title for Current Pagesingle_tag_title();

<?php single_tag_title('prefix', 'display'); ?>

prefix

Text to output before the tag title.

<?php single_tag_title('Tag:', 'display'); ?>

string

display

Display the tag's title (TRUE) or return it for use in PHP (FALSE).

<?php single_tag_title('prefix', 'TRUE'); ?>

TRUE
FALSE

Generates a HTML string of the tags associated with the current post. The name of each tag will be linked to the relevant 'tag' page.