用户 模板函数
<?php the_author(); ?>
显示日志撰写的用户,使用在loop中.
<?php the_author_description(); ?>
显示关于这个用户的描叙,使用在loop中.
<?php the_author_login(); ?>
显示登录的用户,必须用在loop中.
<?php the_author_firstname(); ?>
显示作者的姓,必须用在loop中.
<?php the_author_lastname(); ?>
同上,使用在日志的loop中.
<?php the_author_nickname(); ?>
同上,使用在日志loop中.
<?php the_author_ID(); ?>
显示用户的ID,可以利用它为每篇日志增加一个用户缩略图.
<?php the_author_email(); ?>
用户邮箱链接,可以使用于联系作者.
<?php the_author_url(); ?>
显示用户的网站链接.
<?php the_author_link(); ?>
显示用户的连接.
<?php the_author_aim(); ?>
显示用户的aim信息.
<?php the_author_yim(); ?>
显示用户的YaHoo IM
<?php the_author_posts(); ?>
显示用户在WordPress上面撰写的所有文章.
<?php the_author_posts_link(); ?>
显示用户在WordPress上面的文章的连接.
<?php wp_list_authors('arguments'); ?>
使用于WordPress mu.
<?php wp_list_authors('exclude_admin=1&show_fullname=0'); ?>
optioncount显示每个作者的文章数目. <?php wp_list_authors('optioncount=1'); ?> |
- 1 (true)
- 0 (false)
|
exclude_admin从用户清单中排除'admin'用户. <?php wp_list_authors('exclude_admin=0'); ?>> |
- 1 (true)
- 0 (false)
|
show_fullname显示用户全名,没有的话就显示昵称. <?php wp_list_authors('show_fullname=1'); ?>> |
- 1 (true)
- 0 (false)
|
hide_empty不显抓写日志为0的用户. <?php wp_list_authors('hide_empty=0'); ?> |
- 1 (true)
- 0 (false)
|
feed文字链接到用户撰写日志的Feed. <?php wp_list_authors('feed=RSS'); ?> |
- String
|
feed_image图片链接到用户的Feed. <?php wp_list_authors('feed_image=images/picture.jpg'); ?>> |
- String
|
显示所有作者的清单,并连接到他们的日志和Feed.
分类 模板函数
<?php the_category('arguments'); ?>
seperator文字显示分类链接. <?php the_category('seperator=•'); ?> |
- String
|
parents显示连接主分类和子分类. <?php the_category('parents=multiple'); ?> |
- Single
- 显示连接到单一的分离,利用这样的连接形式 "parent/child".
- Multiple
- 显示连接到主分类,子分类,"parent/child".
|
显示文章的分类链接,必须用在日志loop中.
<?php the_category_rss('arguments'); ?>
typeThe type of feed to display to. <?php the_category_rss('type=rss'); ?> |
- RSS
- RDF
|
显示文章的分类,以及分类的RSS,必须用在日志的loop中.
<?php single_cat_title('prefix', 'display'); ?>
prefixText to output before the category title. Defaults to '' (no text). <?php single_cat_title('•','display'); ?> |
- String
|
displayDisplay the category's title <?php single_cat_title('prefix','TRUE'); ?> |
- TRUE
- FALSE
|
显示或者返回类别标题为当前的网页.
<?php category_description(category); ?>
分类的描叙. <?php category_description('2'); ?> |
|
显示分类的描叙.
<?php wp_dropdown_categories('arguments'); ?>
show_option_allCauses the HTML for the dropdown to allow you to select All of the categories. <?php wp_dropdown_categories('show_option_all='); ?> |
- String
|
show_option_noneCauses the HTML for the dropdown to allow you to select NONE of the categories. <?php wp_dropdown_categories('show_option_none='); ?> |
- String
|
orderbyKey to sort options by. <?php wp_dropdown_categories('orderby=name'); ?> |
- ID
- name
|
orderSort order for options. <?php wp_dropdown_categories('order=DESC'); ?> |
- ASC
- DESC
|
show_last_updateSets 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_countSets whether to display a count of posts in each category. <?php wp_dropdown_categories('show_count=1'); ?> |
- 1 (true)
- 0 (false)
|
hide_emptySets whether to hide (not display) categories with no posts. <?php wp_dropdown_categories('hide_empty=0'); ?> |
- 1 (true)
- 0 (false)
|
child_ofOnly 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
|
excludeComma
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
|
echoDisplay bookmarks (TRUE) or return them for use by PHP (FALSE). <?php wp_dropdown_categories('echo=0'); ?> |
- 1 (true)
- 0 (false)
|
selectedCategory 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
|
heirarchialDisplay categories in hierarchical fashion (child categories show indented). <?php wp_dropdown_categories('heirarchial=1'); ?> |
- 1 (true)
- 0 (false)
|
nameName assigned to the dropdown form. Defaults to 'cat'. <?php wp_dropdown_categories('name=cat-dropdown'); ?> |
- String
|
classClass assinged to the dropdown form. Defaults to 'postform'. <?php wp_dropdown_categories('class=cat-dropdown'); ?> |
- String
|
depthThis 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.
<?php wp_list_categories('arguments'); ?>
show_option_allA
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
|
orderbySort
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
|
orderSort order for categories (either ascending or descending). <?php wp_list_categories('order=DESC'); ?> |
- ASC
- DESC
|
show_last_updatedShould the last updated timestamp for posts be displayed (TRUE) or not (FALSE). <?php wp_list_categories('show_last_updated=1'); ?> |
- 1 (true)
- 0 (false)
|
styleStyle
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_countToggles the display of the current count of posts in each category. <?php wp_list_categories('show_count=1'); ?> |
- 1 (true)
- 0 (false)
|
hide_emptyToggles the display of categories with no posts. <?php wp_list_categories('hide_empty=0'); ?> |
- 1 (true)
- 0 (false)
|
use_desc_for_titleSets 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_ofOnly
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
|
feedDisplay 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_imageSet
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
|
excludeExclude
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
|
includeOnly include the categories detailed in a comma-separated list by unique ID, in ascending order. <?php wp_list_categories('include=5'); ?> |
- Integer
|
heirarchialDisplay sub-categories as inner list items (below the parent list item) or inline. <?php wp_list_categories('heirarchial=0'); ?> |
- 1 (true)
- 0 (false)
|
title_liSet
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
|
numberSets 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
|
echoShow the result or keep it in a variable. <?php wp_list_categories('echo=0'); ?> |
- 1 (true)
- 0 (false)
|
depthThis 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.
<?php if ( in_category('category_id') ): ?>
// Some category specific PHP/HTML here
<?php endif; ?>
category_idThe 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.
<?php echo(get_category_parents(category, display link, separator, nice name)); ?>
categoryThe 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 linkCreates a link to each category displayed. <?php echo(get_category_parents(category, TRUE, separator, nice name)); ?> |
- TRUE
- FALSE
|
seperatorWhat to separate each category by. <?php echo(get_category_parents(category, display link, &;bull;, nice name)); ?> |
- Integer
|
nice nameReturn 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.
<?php foreach((get_the_category()) as $category) {
echo $category->cat_name . ' ';
}
?>
| Member Variables |
| Variable | Description |
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.
评论 模板函数
<?php comments_number('zero', 'one', 'more', 'number'); ?>
zeroText to be displayed if there is no comments <?php comments_number('No Comments', 'one', 'more', 'number'); ?> |
- String
|
oneText to be displayed if there is 1 comment <?php comments_number('zero', '1 Comment', 'more', 'number'); ?> |
- String
|
moreText
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
|
numberNumber 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.
<?php comments_link(); ?>
Displays the URL to a post's comments. This tag must be within The Loop, or the loop set up for comments.
<?php comments_rss_link('text', 'file'); ?>
textLink text for the comments RSS link. Defaults to 'Comments RSS' <?php comments_rss_link('RSS', 'file'); ?> |
- String
|
fileThe 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.
<?php comments_popup_script(width, height); ?>
widthThe width of the popup window. Defaults to 400 (pixels). <?php comments_popup_script(300, height); ?> |
- Integer
|
heightThe 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.
<?php comments_popup_link ('zero','one','more','CSSclass','none'); ?>
zeroText to display if there is no comments. <?php comments_popup_link ('No Comments','one','more','CSSclass'); ?> |
- String
|
oneText to display if there is one comment. <?php comments_popup_link ('zero','1 Comment','more','CSSclass'); ?> |
- String
|
moreText to dislay if there is more than one comment. <?php comments_popup_link ('zero','one','% Comments','CSSclass'); ?> |
- String
|
CSSclassCSS (stylesheet) class for the link. This has no default value. <?php comments_popup_link ('zero','one','more','popup-link'); ?> |
- String
|
noneComments 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).
<?php comment_ID(); ?>
Displays the numeric ID of a comment. This tag must be within The Loop, or a comment loop.
<?php comment_author(); ?>
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.
<?php comment_author_IP(); ?>
Displays the comment author's IP address. This tag must be within The Loop, or a comment loop.
<?php comment_author_email(); ?>
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.
<?php comment_author_url(); ?>
Displays the comment author's URL (usually their web site), not linked. This tag must be within The Loop, or a comment loop.
<?php comment_author_email_link('linktext', 'before', 'after'); ?>
linktextLink text for the email link. Default is the comment author's email address. <?php comment_author_email_link('Email', 'before', 'after'); ?> |
- String
|
beforeText to display before the link. There is no default. <?php comment_author_email_link('linktext', '»', 'after'); ?> |
- String
|
afterText to display after the link. There is no default. <?php comment_author_email_link('linktext', 'before', '«'); ?> |
- 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.
<?php comment_author_link(); ?>
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.
<?php comment_type('comment', 'trackback', 'pingback'); ?>
commentText to describe a comment type comment. Defaults to 'Comment' <?php comment_type('Comment!', 'trackback', 'pingback'); ?> |
- String
|
trackbackText to describe a Trackback type comment. Defaults to 'Trackback'. <?php comment_type('comment', 'Trackback!', 'pingback'); ?> |
- String
|
pingbackText 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.
<?php comment_text(); ?>
Displays the text of a comment. This tag must be within The Loop, or a comment loop.
<?php comment_excerpt(); ?>
Displays an excerpt (maximum of 20 words) of a comment's text. This tag will work within a comment loop.
<?php comment_date(); ?>
dFormatting 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.
<?php comment_time(); ?>
dFormatting 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.
<?php comment_author_rss(); ?>
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.
<?php comment_text_rss(); ?>
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.
<?php comment_link_rss(); ?>
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.
<?php permalink_comments_rss(); ?>
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.
日期&时间模板函数
<?php the_date_xml(); ?>
Displays the date of the post in YYYY-MM-DD format (ex: 2004-09-24). This tag must be used within The Loop.
<?php the_date('format', 'before', 'after', echo); ?>>
formatThe format for the date. Defaults to the date format configured in your WordPress options. <?php the_date('n-j-Y', 'before', 'after', echo); ?> |
- String
|
beforeText to place before the date. There is no default. <?php the_date('format', '»', 'after', echo); ?> |
- String
|
afterText to place after the date. There is no default. <?php the_date('format', 'before', '«', echo); ?> |
- String
|
echoDisplay 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.
<?php the_time('d'); ?>
dFormatting 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.
<?php the_modified_date('d'); ?>
dFormatting 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.
<?php the_modified_time('d'); ?>
dFormatting 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.
<?php get_the_time('format'); ?>
formatThe 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.
<?php single_month_title('prefix', display) ?>
prefixText to place before the title. There is no default. <?php single_month_title('&bull', display) ?> |
- String
|
displayDisplay 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.
<?php get_calendar(); ?>
initialIf
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.
总体 模板函数
<?php bloginfo('arguments'); ?>
nameWeblog title; set in General Options. (Default) <?php bloginfo('name'); ?> |
- Argument
|
descriptionTagline for your blog; set in General Options. <?php bloginfo('description'); ?> |
- Argument
|
urlURL for your blog's web site address. <?php bloginfo('url'); ?> |
- Argument
|
rdf_urlURL for RDF/RSS 1.0 feed. <?php bloginfo('rdf_url'); ?> |
- Argument
|
rss_urlURL for RSS 0.92 feed. <?php bloginfo('rss_url'); ?> |
- Argument
|
rss2_urlURL for RSS 2.0 feed. <?php bloginfo('rss2_url'); ?> |
- Argument
|
atom_urlURL for Atom feed. <?php bloginfo('atom_url'); ?> |
- Argument
|
comments_rss2_urlURL for comments RSS 2.0 feed. <?php bloginfo('comments_rss2_url'); ?> |
- Argument
|
pingback_urlURL for Pingback (XML-RPC file). <?php bloginfo('pingback_url'); ?> |
- Argument
|
admin_emailAdministrator's email address; set in General Options. <?php bloginfo('admin_email'); ?> |
- Argument
|
charsetCharacter encoding for your blog; set in Reading Options. <?php bloginfo('charset'); ?> |
- Argument
|
versionVersion of WordPress your blog uses. <?php bloginfo('version'); ?> |
- Argument
|
html_type"Content-type" for your blog. <?php bloginfo('html_type'); ?> |
- Argument
|
wpurlURL for WordPress installation. <?php bloginfo('wpurl'); ?> |
- Argument
|
template_urlURL for template in use. <?php bloginfo('template_url'); ?> |
- Argument
|
template_directoryURL for template's directory. <?php bloginfo('template_directory'); ?> |
- Argument
|
stylesheet_urlURL
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().
<?php bloginfo_rss('arguments'); ?>
nameWeblog title; set in General Options. (Default) <?php bloginfo('name'); ?> |
- Argument
|
descriptionTagline for your blog; set in General Options. <?php bloginfo('description'); ?> |
- Argument
|
urlURL for your blog's web site address. <?php bloginfo('url'); ?> |
- Argument
|
rdf_urlURL for RDF/RSS 1.0 feed. <?php bloginfo('rdf_url'); ?> |
- Argument
|
rss_urlURL for RSS 0.92 feed. <?php bloginfo('rss_url'); ?> |
- Argument
|
rss2_urlURL for RSS 2.0 feed. <?php bloginfo('rss2_url'); ?> |
- Argument
|
atom_urlURL for Atom feed. <?php bloginfo('atom_url'); ?> |
- Argument
|
comments_rss2_urlURL for comments RSS 2.0 feed. <?php bloginfo('comments_rss2_url'); ?> |
- Argument
|
pingback_urlURL for Pingback (XML-RPC file). <?php bloginfo('pingback_url'); ?> |
- Argument
|
admin_emailAdministrator's email address; set in General Options. <?php bloginfo('admin_email'); ?> |
- Argument
|
charsetCharacter encoding for your blog; set in Reading Options. <?php bloginfo('charset'); ?> |
- Argument
|
versionVersion of WordPress your blog uses. <?php bloginfo('version'); ?> |
- Argument
|
html_type"Content-type" for your blog. <?php bloginfo('html_type'); ?> |
- Argument
|
wpurlURL for WordPress installation. <?php bloginfo('wpurl'); ?> |
- Argument
|
template_urlURL for template in use. <?php bloginfo('template_url'); ?> |
- Argument
|
template_directoryURL for template's directory. <?php bloginfo('template_directory'); ?> |
- Argument
|
stylesheet_urlURL
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.
<?php get_bloginfo('arguments'); ?>
nameDefault,
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
|
descriptionthe
Tagline set in Administration > Options > General. This data is
retrieved from the blogdescription record in the wp_options table. <?php get_bloginfo('description'); ?> |
- Argument
|
urlDisplays
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
|
homeDisplays
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
|
siteurlDisplays
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
|
wpurlthe
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_urlURL 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_urlURL 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_urlURL 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_urlURL 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_urlURL 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_urlURL for Pingback (XML-RPC file) which is your Blog address (URI) appended with the string /xmlrpc.php. <?php get_bloginfo('pingback_url'); ?> |
- Argument
|
stylesheet_urlURL
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_directoryURL
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_directoryURL
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_urlURL
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_emailthe
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
|
charsetthe
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
|
versionVersion 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.
<?php get_bloginfo_rss('arguments'); ?>
nameWeblog title; set in General Options. (Default) <?php get_bloginfo_rss('name'); ?> |
- Argument
|
descriptionTagline for your blog; set in General Options. <?php get_bloginfo_rss('description'); ?> |
- Argument
|
urlURL for your blog's web site address. <?php get_bloginfo_rss('url'); ?> |
- Argument
|
rdf_urlURL for RDF/RSS 1.0 feed. <?php get_bloginfo_rss('rdf_url'); ?> |
- Argument
|
rss_urlURL for RSS .92 feed. <?php get_bloginfo_rss('rss_url'); ?> |
- Argument
|
rss2_urlURL for RSS 2.0 feed. <?php get_bloginfo_rss('rss2_url'); ?> |
- Argument
|
atom_urlURL for Atom feed. <?php get_bloginfo_rss('atom_url'); ?> |
- Argument
|
comments_rss2_urlURL for comments RSS 2.0 feed. <?php get_bloginfo_rss('comments_rss2_url'); ?> |
- Argument
|
pingback_urlURL for Pingback (XML-RPC file). <?php get_bloginfo_rss('pingback_url'); ?> |
- Argument
|
admin_emailAdministrator's email address; set in General Options. <?php get_bloginfo_rss('admin_email'); ?> |
- Argument
|
charsetCharacter encoding for your blog; set in Reading Options. <?php get_bloginfo_rss('charset'); ?> |
- Argument
|
versionVersion 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_urlURL for template in use. <?php get_bloginfo_rss('template_url'); ?> |
- Argument
|
template_directoryURL for template's directory. <?php get_bloginfo_rss('template_directory'); ?> |
- Argument
|
stylesheet_urlURL for primary CSS file. <?php get_bloginfo_rss('stylesheet_url'); ?> |
- Argument
|
stylesheet_directoryURL 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.
<?php wp_title('sep', echo, 'seplocation'); ?>
sepText
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
|
echoEcho the title (True) or return the title for use as a PHP string (False). <?php wp_title('sep', 1, 'seplocation'); ?> |
- 1 (true)
- 0 (false)
|
seplocationIntroduced
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.
<?php get_posts('arguments'); ?>
numberpostsNumber of posts to return. <?php get_posts('numberposts=10'); ?> |
- Integer (defaults to 5)
|
offsetOffset from latest post. <?php get_posts('offset=1'); ?> |
- Integer (defaults to 0)
|
categoryOnly show posts from this category ID. <?php get_posts('category=2'); ?> |
- Integer
|
orderbySort 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.
|
orderHow to sort 'orderby'. <?php get_posts('order=DESC'); ?> |
- ASC
- Ascending (lowest to highest).
- DESC
- Descending (highest to lowest).
|
includeThe IDs of the posts you want to show, separated by commas and/or spaces. <?php get_posts('include=62'); ?> |
- Integer
|
excludeThe IDs of any posts you want to exclude, separated by commas and/or spaces <?php get_posts('exclude=62'); ?> |
- Integer
|
meta_key and meta_valueOnly
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_typeThe type of post to show. <?php get_posts('post_type=page'); ?> |
- post
- page
- attachment
- (blank)
- all post types
|
post_statusShow posts with a particular status. <?php get_posts('post_status=draft'); ?> |
- publish
- private
- draft
- future
- (blank)
|
post_parentShow 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.
<?php wp_get_archives('arguments'); ?>
typeThe type of archive list to display. Defaults to WordPress settings. <?php wp_get_archives('type=yearly'); ?> |
- yearly
- monthly
- daily
- weekly
- postbypost
|
limitNumber of archives to get. Default is no limit. <?php wp_get_archives('limit=5'); ?> |
- Integer
|
formatFormat for the archive list. <?php wp_get_archives('format=link'); ?> |
- html
- In HTML list (
- ) tags and before and after strings.
- option
- In select (<select>) or dropdown option (<option>) tags.
- link
- Within link () tags.
- custom
- Custom list using the before and after strings.
|
beforeText to place before the link when using the html or custom for format option. There is no default. <?php wp_get_archives('before=»'); ?> |
- String
|
afterText 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_countDisplay 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.
<?php wp_list_pages('arguments'); ?>
sort_columnSorts 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_orderChange 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.
|
excludeDefine a comma-separated list of Page IDs to be excluded from the list <?php wp_list_pages('exclude=62'); ?> |
- Integer
|
includeOnly
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
|
depthThis 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_ofDisplays 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_dateDisplay 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_formatControls
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_liSet the text and style of the Page list's heading. <?php wp_list_pages('title_li=Page List'); ?> |
- String
|
echoToggles 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)
|
hierarchialDisplay
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_valueOnly 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.
<?php wp_dropdown_pages('arguments'); ?>
depthThis 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_ofDisplays 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
|
selectedPage 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
|
echoToggles
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)
|
nameName assigned to the dropdown form. Defaults to 'page_id'. <?php wp_dropdown_pages('name=page-id'); ?> |
- String
|
show_option_noneCauses the HTML for the dropdown to allow you to select NONE of the pages. <?php wp_dropdown_pages('show_option_none='); ?> |
- String
|
excludeComma 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.
<?php wp_loginout(); ?>
Displays a login link, or if a user is logged in, a logout link.
<?php wp_register('before', 'after'); ?>
beforeText to display before the Register or Site Admin link. Default is '<li>'. <?php wp_register('»', 'after'); ?> |
- String
|
afterText to display after the Register or Site Admin link. Default is '</li>'. <?php wp_register('before', '«'); ?> |
- 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.
<?php query_posts('parameters'); ?>
catDisplay the posts from one or more category ID's. <?php query_posts('cat=7'); ?> |
- Integer
|
category_nameDisplay posts with a certain category name. <?php query_posts('category_name=Sports'); ?> |
- String
|
tagShow posts associated with certain tags. <?php query_posts('tag=basketball'); ?> |
- String
|
author_nameShow posts by an author with a certain name. <?php query_posts('author_name=Chase'); ?> |
- String
|
authorShow posts by an author with a certain ID. <?php query_posts('author=3'); ?> |
- Integer
|
pUse the post ID to show the first post. <?php query_posts('p=9'); ?> |
- Integer
|
nameUse the post slug to show the first post. <?php query_posts('name=chase-crawford'); ?> |
- String
|
page_idShow posts from a page with a certain ID. <?php query_posts('page_id=11'); ?> |
- Integer
|
pagenameShow posts from this page with a certain name. <?php query_posts('pagename=about'); ?> |
- String
|
showpostsShow a limited amount of posts. <?php query_posts('showposts=11'); ?> |
- Integer
|
hourShow post belonging to this hour. <?php query_posts('hour=12'); ?> |
- Integer
|
minuteShow posts belonging to this minute. <?php query_posts('minutes=33'); ?> |
- Integer
|
secondShow posts belonging to this second. <?php query_posts('second=59'); ?> |
- Integer
|
dayShow posts belonging to this day. <?php query_posts('day=14'); ?> |
- Integer
|
monthnumShow posts belonging to this month. <?php query_posts('monthnum=6'); ?> |
- Integer
|
yearShow posts belonging to this year. <?php query_posts('year=2003'); ?> |
- Integer
|
pagedshow 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_pagenumber of posts to show per page; a value of -1 will show all posts. <?php query_posts('post_per_page=5'); ?> |
- Integer
|
orderWhat order to display posts in. <?php query_posts('order=ASC'); ?> |
- ASC
- DESC
|
offsetDisplaces or passes over one or more initial posts which would normally be collected by your query. <?php query_posts('offset=1'); ?> |
- Integer
|
orderbySort 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.
<?php rss_enclosure(); ?>
Transforms links to audio or video files in a post into RSS enclosures. Used for Podcasting.
<?php wp_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 the_search_query(''); ?>
Displays the search query for the current request, if a search was made.
链接 模板函数
<?php edit_post_link('link', 'before', 'after'); ?>
linkThe link text. Defaults to 'Edit This'. <?php edit_post_link('Edit', 'before', 'after'); ?> |
- String
|
beforeText to put before the link text. There is no default. <?php edit_post_link('link', '»', 'after'); ?> |
- String
|
afterText to put after the link text. There is no default. <?php edit_post_link('link', 'before', '«'); ?> |
- String
|
Displays a link to edit the current post, if a user is logged in and allowed to edit the post.
<?php edit_comment_link('link', 'before', 'after'); ?>
linkThe link text. Defaults to 'Edit This'. <?php edit_post_link('Edit', 'before', 'after'); ?> |
- String
|
beforeText to put before the link text. There is no default. <?php edit_post_link('link', '»', 'after'); ?> |
- String
|
afterText to put after the link text. There is no default. <?php edit_post_link('link', 'before', '«'); ?> |
- String
|
Displays a link to edit the current comment, if the user is logged in and allowed to edit the comment.
<?php wp_page_links('arguments'); ?>
beforeText to put before all the links. Defaults to <p>Pages: <?php wp_page_links('before=<div>'); ?> |
- String
|
afterText to put after all the links. Defaults to </p>. <?php wp_page_links('after=</div>'); ?> |
- String
|
next_or_numberIndicates whether page numbers should be used. <?php wp_page_links('next_or_number=next'); ?> |
- number
- next
|
nextpagelinkText for link to next page. Defaults to Next page. <?php wp_page_links('nextpagelink=Next'); ?> |
- String
|
previouspagelinkText for link to previous page. Defaults to Previous page. <?php wp_page_links('previouspagelink=Previous'); ?> |
- String
|
pagelinkFormat
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_filePage 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.
<?php get_year_link('year'); ?>
yearThe 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.
<?php get_month_link('year','month'); ?>
yearThe year for the archive. Use '' to assign current year. <?php get_month_link('2003','month'); ?> |
- Integer
|
monthThe 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.
<?php get_day_link('year','month','day'); ?>
yearThe year for the archive. Use '' to assign current year. <?php get_day_link('2003','month','day'); ?> |
- Integer
|
monthThe month for the archive. Use '' to assign current month. <?php get_day_link('year','10','day'); ?> |
- Integer
|
dayThe 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.
<?php next_posts_link('Label', 'Max number of pages (default 0)'); ?>
This creates a link to the previous posts. Yes, it says "next posts," but it's named that just to confuse you.
永久链接 模板函数
<?php permalink_anchor('type'); ?>
typeType 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.
<?php get_permalink(id); ?>
idThe 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.
<?php the_permalink(); ?>
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.
<?php permalink_single_rss('file'); ?>
fileThe 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.
文章 模板函数
<?php the_ID(); ?>
Displays the numeric ID of the current post.
<?php the_title(); ?>
beforeText to place before the title. Defaults to ''. <?php the_title("before=»"); ?> |
- String
|
afterText to place after the title. Defaults to ''. <?php the_title("after=«"); ?> |
- String
|
displayDisplay 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.
<?php the_title_attribute('arguments'); ?>
beforeText to place before the title. Defaults to ''. <?php the_title("before=»"); ?> |
- String
|
afterText to place after the title. Defaults to ''. <?php the_title("after=«"); ?> |
- String
|
echoDisplay 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.
<?php single_post_title('prefix', display); ?>
prefixText to place before the title. Defaults to ''. <?php single_post_title('•', display); ? |
- String
|
displayShould 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).
<?php the_title_rss(); ?>
Displays the title of the current post, formatted for RSS. This tag must be within The Loop.
<?php the_content('more_link_text', strip_teaser, 'more_file'); ?>
more_link_textThe link text to display for the "more" link. Defaults to '(more...)'. <?php the_content('More', strip_teaser, 'more_file'); ?> |
- String
|
strip_teaserShould the text before the "more" link be hidden (TRUE) or displayed (FALSE). <?php the_content('more_link_text', TRUE, 'more_file'); ?> |
- TRUE
- FALSE
|
more_fileFile 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.
<?php the_content_rss('more_link_text', strip_teaser, 'more_file'),cut, encode_html; ?>
more_link_textThe 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_teaserShould 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_fileFile 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
|
cutNumber 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_htmlDefines 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.
<?php the_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_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 previous_post_link('format', 'link', in_same_cat, 'excluded_categories'); ?>
formatFormat
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
|
linkLink 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_catIndicates
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_categoriesNumeric
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.
<?php next_post_link('format', 'link', in_same_cat, 'excluded_categories'); ?>
formatFormat
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
|
linkLink 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_catIndicates
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_categoriesNumeric
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.
<?php posts_nav_link('sep','prelabel','nxtlabel'); ?>
sepText displayed between the links. <?php posts_nav_link(',','prelabel','nxtlabel'); ?> |
- String
|
prelabelLink text for the previous page. <?php posts_nav_link('sep','»','nxtlabel'); ?> |
- String
|
nxtlabelLink text for the next page. <?php posts_nav_link('sep','prelabel','«'); ?> |
- String
|
Displays links for next and previous pages. Useful for providing "paged" navigation of index, category and archive pages.
<?php the_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_tags('before', 'separator', 'after'); ?>
beforeText to display before the actual tags are displayed. Defaults to Tags: <?php the_tags('Post Tags:', 'separator', 'after'); ?> |
- String
|
seperatorText or character to display between each tag link. The default is a comma (,) between each tag. <?php the_tags('before', '|', 'after'); ?> |
- String
|
afterText 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.
<?php wp_count_posts('type', 'status'); ?>
typeType of row in wp_posts to count where type is equal to post_type. <?php wp_count_posts('post', 'status'); ?> |
- post
- page
|
statusStatus 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.
标签 模板函数
<?php wp_tag_cloud(); ?>
smallestThe text size of the tag with the smallest count value (units given by unit parameter). <?php wp_tag_cloud(); ?> |
- Integer
|
largestThe text size of the tag with the highest count value (units given by the unit parameter). <?php wp_tag_cloud(); ?> |
- Integer
|
unitUnit
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
|
numberThe number of actual tags to display in the cloud. (Use '0' to display all tags.) <?php wp_tag_cloud(); ?> |
- Integer
|
formatFormat 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
|
orderbyOrder of the tags. <?php wp_tag_cloud(); ?> |
- name
- count
|
orderSort order. <?php wp_tag_cloud(); ?> |
- ASC
- DESC
- RAND
- Tags are in a random order.
|
excludeComma
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
|
includeComma
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.
<?php get_the_tags(); ?>
| Member Variables |
term_idthe tag ID |
namethe tag name |
sluga slug generated from the tag name |
term_groupthe group of the tag, if any |
taxonomyshould always be 'post_tag' for this case |
descriptionthe tag description |
countnumber 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..
<?php get_the_tag_list(); ?>
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.