WordPress V2.xTemplate Tag Reference Guide as of Version 2.x
Presented by:
General Link Tags
Blog Infobloginfo();
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().
<?php bloginfo('arguments'); ?>
name
Weblog title; set in General Options. (Default)
<?php bloginfo('name'); ?>
description
Tagline for your blog; set in General Options.
<?php bloginfo('description'); ?>
url
URL for your blog's web site address.
<?php bloginfo('url'); ?>
rdf_url
URL for RDF/RSS 1.0 feed.
<?php bloginfo('rdf_url'); ?>
rss_url
URL for RSS 0.92 feed.
<?php bloginfo('rss_url'); ?>
rss2_url
URL for RSS 2.0 feed.
<?php bloginfo('rss2_url'); ?>
atom_url
URL for Atom feed.
<?php bloginfo('atom_url'); ?>
comments_rss2_url
URL for comments RSS 2.0 feed.
<?php bloginfo('comments_rss2_url'); ?>
pingback_url
URL for Pingback (XML-RPC file).
<?php bloginfo('pingback_url'); ?>
admin_email
Administrator's email address; set in General Options.
<?php bloginfo('admin_email'); ?>
charset
Character encoding for your blog; set in Reading Options.
<?php bloginfo('charset'); ?>
version
Version of WordPress your blog uses.
<?php bloginfo('version'); ?>
html_type
"Content-type" for your blog.
<?php bloginfo('html_type'); ?>
wpurl
URL for WordPress installation.
<?php bloginfo('wpurl'); ?>
template_url
URL for template in use.
<?php bloginfo('template_url'); ?>
template_directory
URL for template's directory.
<?php bloginfo('template_directory'); ?>
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'); ?>
Blog Info RSSbloginfo_rss();
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.
<?php bloginfo_rss('arguments'); ?>
name
Weblog title; set in General Options. (Default)
<?php bloginfo('name'); ?>
description
Tagline for your blog; set in General Options.
<?php bloginfo('description'); ?>
url
URL for your blog's web site address.
<?php bloginfo('url'); ?>
rdf_url
URL for RDF/RSS 1.0 feed.
<?php bloginfo('rdf_url'); ?>
rss_url
URL for RSS 0.92 feed.
<?php bloginfo('rss_url'); ?>
rss2_url
URL for RSS 2.0 feed.
<?php bloginfo('rss2_url'); ?>
atom_url
URL for Atom feed.
<?php bloginfo('atom_url'); ?>
comments_rss2_url
URL for comments RSS 2.0 feed.
<?php bloginfo('comments_rss2_url'); ?>
pingback_url
URL for Pingback (XML-RPC file).
<?php bloginfo('pingback_url'); ?>
admin_email
Administrator's email address; set in General Options.
<?php bloginfo('admin_email'); ?>
charset
Character encoding for your blog; set in Reading Options.
<?php bloginfo('charset'); ?>
version
Version of WordPress your blog uses.
<?php bloginfo('version'); ?>
html_type
"Content-type" for your blog.
<?php bloginfo('html_type'); ?>
wpurl
URL for WordPress installation.
<?php bloginfo('wpurl'); ?>
template_url
URL for template in use.
<?php bloginfo('template_url'); ?>
template_directory
URL for template's directory.
<?php bloginfo('template_directory'); ?>
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'); ?>
Blog Info (PHP)get_bloginfo();
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.
<?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'); ?>
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'); ?>
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'); ?>
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'); ?>
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'); ?>
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'); ?>
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'); ?>
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'); ?>
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'); ?>
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'); ?>
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'); ?>
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'); ?>
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'); ?>
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'); ?>
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'); ?>
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'); ?>
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'); ?>
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'); ?>
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'); ?>
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'); ?>
Blog Info RSS (PHP)get_bloginfo_rss();
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.
<?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
Page Titlewp_title();
Displays or returns the title of the page.
<?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 » (») symbol will be placed before or after (specified by the seplocation) the post title.
<?php wp_title('•', 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'
right
Get Postsget_posts;
This is a simple tag for creating multiple loops.
<?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
post_date
post_modified
ID
post_author
post_name
order
How to sort 'orderby'.
<?php get_posts('order=DESC'); ?>
ASC
DESC
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)
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
Archives Listwp_get_archives();
This function displays a date-based archives list.
<?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
option
link
custom
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=»'); ?>
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=«'); ?>
String
show_post_count
Display number of posts in an archive.
<?php wp_get_archives('show_post_count=1'); ?>
1 (true)
0 (false)
Page Link Listwp_list_pages();
The Template Tag, wp_list_pages(), displays a list of WordPress Pages as links.
<?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
menu_order
post_date
post_modified
ID
post_author
post_name
sort_order
Change the sort order of the list of Pages (either ascending or descending).
<?php wp_list_pages('sort_order=desc'); ?>
asc
desc
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
-1
1
2
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'); ?>
' '
modified
xxx
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
Page Dropdownwp_dropdown_pages();
Displays a list of pages in a select (i.e dropdown) box with no submit button.
<?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
-1
1
n
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)
Login/Logout Linkwp_loginout();
Displays a login link, or if a user is logged in, a logout link.
<?php wp_loginout(); ?>
No Parameters.
Register/Site Admin Linkwp_register();
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.
<?php wp_register('before', 'after'); ?>
before
Text to display before the Register or Site Admin link. Default is '<li>'.
<?php wp_register('»', 'after'); ?>
String
after
Text to display after the Register or Site Admin link. Default is '</li>'.
<?php wp_register('before', '«'); ?>
String
Query Postsquery_posts();
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.
<?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'); ?>
showposts
Show a limited amount of posts.
<?php query_posts('showposts=11'); ?>
hour
Show post belonging to this hour.
<?php query_posts('hour=12'); ?>
minute
Show posts belonging to this minute.
<?php query_posts('minutes=33'); ?>
second
Show posts belonging to this second.
<?php query_posts('second=59'); ?>
day
Show posts belonging to this day.
<?php query_posts('day=14'); ?>
monthnum
Show posts belonging to this month.
<?php query_posts('monthnum=6'); ?>
year
Show posts belonging to this year.
<?php query_posts('year=2003'); ?>
paged
show the posts that would normally show up just on page 2 when using the "Older Entries" link.
<?php query_posts('paged=3'); ?>
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'); ?>
order
What order to display posts in.
<?php query_posts('order=ASC'); ?>
offset
Displaces or passes over one or more initial posts which would normally be collected by your query.
<?php query_posts('offset=1'); ?>
orderby
Sort retrieved posts by this field.
<?php query_posts('orderby=title'); ?>
RSS Enclosuresrss_enclosure();
Transforms links to audio or video files in a post into RSS enclosures. Used for Podcasting.
<?php rss_enclosure(); ?>
Tag Cloudwp_tag_cloud();
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.
<?php wp_tag_cloud(''); ?>
Search Querythe_search_query();
Displays the search query for the current request, if a search was made.
<?php the_search_query(''); ?>