WordPress 模板函数使用和简介
返回>>逍遥乱弹用户 模板函数
用户 the_author();
<?php the_author(); ?>
|
显示日志撰写的用户,使用在loop中.
用户描叙 the_author_description();
<?php the_author_description(); ?>
|
显示关于这个用户的描叙,使用在loop中.
用户登陆 the_author_login();
<?php the_author_login(); ?>
|
显示登录的用户,必须用在loop中.
用户的姓 the_author_firstname();
<?php the_author_firstname(); ?>
|
显示作者的姓,必须用在loop中.
显示用户的名 the_author_lastname();
<?php the_author_lastname(); ?>
|
同上,使用在日志的loop中.
用户昵称 the_author_nickname();
<?php the_author_nickname(); ?>
|
同上,使用在日志loop中.
用户ID the_author_ID();
<?php the_author_ID(); ?>
|
显示用户的ID,可以利用它为每篇日志增加一个用户缩略图.
用户的邮箱the_author_email();
<?php the_author_email(); ?>
|
用户邮箱链接,可以使用于联系作者.
用户的网站the_author_url();
<?php the_author_url(); ?>
|
显示用户的网站链接.
用户的连接the_author_link();
<?php the_author_link(); ?>
|
显示用户的连接.
Author AIM Screennamethe_author_aim();
<?php the_author_aim(); ?>
|
显示用户的aim信息.
用户的 Yahoo IM IDthe_author_yim();
<?php the_author_yim(); ?>
|
显示用户的YaHoo IM
用户所有文章the_author_posts();
<?php the_author_posts(); ?>
|
显示用户在WordPress上面撰写的所有文章.
用户文章链接the_author_posts_link();
<?php the_author_posts_link(); ?>
|
显示用户在WordPress上面的文章的连接.
用户清单wp_list_authors();
<?php wp_list_authors('arguments'); ?>
使用于WordPress mu.
<?php
wp_list_authors('exclude_admin=1&show_fullname=0'); ?>
optioncount显示每个作者的文章数目. <?php wp_list_authors('optioncount=1'); ?> |
|
exclude_admin从用户清单中排除'admin'用户. <?php wp_list_authors('exclude_admin=0'); ?>> |
|
show_fullname显示用户全名,没有的话就显示昵称. <?php wp_list_authors('show_fullname=1'); ?>> |
|
hide_empty不显抓写日志为0的用户. <?php wp_list_authors('hide_empty=0'); ?> |
|
feed文字链接到用户撰写日志的Feed. <?php wp_list_authors('feed=RSS'); ?> |
|
feed_image图片链接到用户的Feed. <?php wp_list_authors('feed_image=images/picture.jpg'); ?>> |
|
显示所有作者的清单,并连接到他们的日志和Feed.
分类 模板函数
文章分类the_category();
<?php the_category('arguments'); ?>
seperator文字显示分类链接. <?php the_category('seperator=•'); ?> |
|
parents显示连接主分类和子分类. <?php the_category('parents=multiple'); ?> |
|
显示文章的分类链接,必须用在日志loop中.
分类RSSthe_category_rss();
<?php the_category_rss('arguments'); ?>
typeThe type of feed to display to. <?php the_category_rss('type=rss'); ?> |
|
显示文章的分类,以及分类的RSS,必须用在日志的loop中.
页面分类标题single_cat_title();
<?php single_cat_title('prefix', 'display'); ?>
prefixText to output before the category title. Defaults to '' (no text). <?php single_cat_title('•','display'); ?> |
|
displayDisplay the category's title <?php single_cat_title('prefix','TRUE'); ?> |
|
显示或者返回类别标题为当前的网页.
分类描叙category_description();
<?php category_description(category); ?>
分类的描叙. <?php category_description('2'); ?> |
|
显示分类的描叙.
分类下拉菜单wp_dropdown_categories('arguments');
<?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='); ?> |
|
show_option_noneCauses the HTML for the dropdown to allow you to select NONE of the categories. <?php wp_dropdown_categories('show_option_none='); ?> |
|
orderbyKey to sort options by. <?php wp_dropdown_categories('orderby=name'); ?> |
|
orderSort order for options. <?php wp_dropdown_categories('order=DESC'); ?> |
|
show_last_updateSets whether to display the date of the last post in each category. <?php wp_dropdown_categories('show_last_update=1'); ?> |
|
show_countSets whether to display a count of posts in each category. <?php wp_dropdown_categories('show_count=1'); ?> |
|
hide_emptySets whether to hide (not display) categories with no posts. <?php wp_dropdown_categories('hide_empty=0'); ?> |
|
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'); ?> |
|
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'); ?> |
|
echoDisplay bookmarks (TRUE) or return them for use by PHP (FALSE). <?php wp_dropdown_categories('echo=0'); ?> |
|
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'); ?> |
|
heirarchialDisplay categories in hierarchical fashion (child categories show indented). <?php wp_dropdown_categories('heirarchial=1'); ?> |
|
nameName assigned to the dropdown form. Defaults to 'cat'. <?php wp_dropdown_categories('name=cat-dropdown'); ?> |
|
classClass assinged to the dropdown form. Defaults to 'postform'. <?php wp_dropdown_categories('class=cat-dropdown'); ?> |
|
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'); ?> |
|
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_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='); ?> |
|
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'); ?> |
|
orderSort order for categories (either ascending or descending). <?php wp_list_categories('order=DESC'); ?> |
|
show_last_updatedShould the last updated timestamp for posts be displayed (TRUE) or not (FALSE). <?php wp_list_categories('show_last_updated=1'); ?> |
|
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'); ?> |
|
show_countToggles the display of the current count of posts in each category. <?php wp_list_categories('show_count=1'); ?> |
|
hide_emptyToggles the display of categories with no posts. <?php wp_list_categories('hide_empty=0'); ?> |
|
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'); ?> |
|
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'); ?> |
|
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'); ?> |
|
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'); ?> |
|
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'); ?> |
|
includeOnly include the categories detailed in a comma-separated list by unique ID, in ascending order. <?php wp_list_categories('include=5'); ?> |
|
heirarchialDisplay sub-categories as inner list items (below the parent list item) or inline. <?php wp_list_categories('heirarchial=0'); ?> |
|
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'); ?> |
|
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'); ?> |
|
echoShow the result or keep it in a variable. <?php wp_list_categories('echo=0'); ?> |
|
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'); ?> |
|
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_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')): ?> |
|
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)); ?>
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)); ?> |
|
display linkCreates a link to each category displayed. <?php echo(get_category_parents(category, TRUE, separator, nice name)); ?> |
|
seperatorWhat to separate each category by. <?php echo(get_category_parents(category, display link, &;bull;, nice name)); ?> |
|
nice nameReturn category nice name or not <?php echo(get_category_parents(category, display link, seperator, TRUE)); ?> |
|
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 | |
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.
评论 模板函数
评论数目comments_number();
<?php comments_number('zero', 'one', 'more', 'number'); ?>
zeroText to be displayed if there is no comments <?php comments_number('No Comments', 'one', 'more', 'number'); ?> |
|
oneText to be displayed if there is 1 comment <?php comments_number('zero', '1 Comment', 'more', 'number'); ?> |
|
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'); ?> |
|
numberNumber of comments. Defaults to the total actual number of comments <?php comments_number('zero', 'one', 'more', '5'); ?> |
|
Displays the total number of comments, Trackbacks, and Pingbacks for a post. This tag must be within The Loop.
链接到日志的评论comments_link();
<?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.
链接到日志评论的RSScomments_rss_link();
<?php comments_rss_link('text', 'file'); ?>
textLink text for the comments RSS link. Defaults to 'Comments RSS' <?php comments_rss_link('RSS', 'file'); ?> |
|
fileThe file the link points to. Defaults to 'wp-commentsrss2.php'. <?php comments_rss_link('text', 'wp-commentsrss2.php'); ?> |
|
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); ?>
widthThe width of the popup window. Defaults to 400 (pixels). <?php comments_popup_script(300, height); ?> |
|
heightThe height of the popup window. Defaults to 400 (pixels). <?php comments_popup_script(width, 300); ?> |
|
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'); ?>
zeroText to display if there is no comments. <?php comments_popup_link ('No Comments','one','more','CSSclass'); ?> |
|
oneText to display if there is one comment. <?php comments_popup_link ('zero','1 Comment','more','CSSclass'); ?> |
|
moreText to dislay if there is more than one comment. <?php comments_popup_link ('zero','one','% Comments','CSSclass'); ?> |
|
CSSclassCSS (stylesheet) class for the link. This has no default value. <?php comments_popup_link ('zero','one','more','popup-link'); ?> |
|
noneComments off. <?php comments_popup_link ('none'); ?> |
|
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).
评论IDcomment_ID();
<?php comment_ID(); ?>
|
Displays the numeric ID of a comment. This tag must be within The Loop, or a comment loop.
评论者comment_author();
<?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.
评论者的IPcomment_author_IP();
<?php comment_author_IP(); ?>
|
Displays the comment author's IP address. This tag must be within The Loop, or a comment loop.
评论者的邮箱comment_author_email();
<?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.
评论者的WebSitecomment_author_url();
<?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.
评论者的邮箱链接comment_author_email_link();
<?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'); ?> |
|
beforeText to display before the link. There is no default. <?php comment_author_email_link('linktext', '»', 'after'); ?> |
|
afterText to display after the link. There is no default. <?php comment_author_email_link('linktext', 'before', '«'); ?> |
|
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.
评论者的网站链接comment_author_link();
<?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.
Type of Commentcomment_type();
<?php comment_type('comment', 'trackback', 'pingback'); ?>
commentText to describe a comment type comment. Defaults to 'Comment' <?php comment_type('Comment!', 'trackback', 'pingback'); ?> |
|
trackbackText to describe a Trackback type comment. Defaults to 'Trackback'. <?php comment_type('comment', 'Trackback!', 'pingback'); ?> |
|
pingbackText to describe a Pingback type comment. Defaults to 'Pingback'. <?php comment_type('comment', 'trackback', 'Pingback!'); ?> |
|
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_text();
<?php comment_text(); ?>
|
Displays the text of a comment. This tag must be within The Loop, or a comment loop.
评论简介comment_excerpt();
<?php comment_excerpt(); ?>
|
Displays an excerpt (maximum of 20 words) of a comment's text. This tag will work within a comment loop.
评论日期comment_date();
<?php comment_date(); ?>
dFormatting for the date. Defaults to the date format set in WordPress. <?php comment_date('n-j-Y'); ?> |
|
Displays the date a comment was posted. This tag must be within The Loop, or a comment loop.
评论时间comment_time();
<?php comment_time(); ?>
dFormatting for the time. Defaults to the time format set in WordPress. <?php comment_time('H:i:s'); ?> |
|
Displays the time a comment was posted. This tag must be within The Loop, or a comment loop.
所有评论者的RSScomment_author_rss();
<?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.
评论RSScomment_text_rss();
<?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.
评论链接RSScomment_link_rss();
<?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.
评论永久链接RSSpermalink_comments_rss();
<?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.
日期&时间模板函数
文章日期 (xml)the_date_xml();
<?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.
文章日期the_date();
<?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); ?> |
|
beforeText to place before the date. There is no default. <?php the_date('format', '»', 'after', echo); ?> |
|
afterText to place after the date. There is no default. <?php the_date('format', 'before', '«', echo); ?> |
|
echoDisplay the date (TRUE), or return the date to be used in PHP (FALSE). <?php the_date('format', 'before', 'after', TRUE); ?> |
|
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.
文章时间the_time();
<?php the_time('d'); ?>
dFormatting for the time. Defaults to the time format set in WordPress. <?php the_time('H:i:s'); ?> |
|
Displays the time of the current post. This tag must be used within The Loop.
文章最后修改日期the_modified_date();
<?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'); ?> |
|
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.
文章修改最后时间the_modified_time();
<?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'); ?> |
|
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.
文章时间get_the_time();
<?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(); ?> |
|
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) ?>
prefixText to place before the title. There is no default. <?php single_month_title('&bull', display) ?> |
|
displayDisplay the title (TRUE), or return the title to be used in PHP (FALSE). <?php single_month_title('prefix', 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(); ?>
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); ?> |
|
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.
总体 模板函数
博客信息bloginfo();
<?php bloginfo('arguments'); ?>
nameWeblog title; set in General Options. (Default) <?php bloginfo('name'); ?> |
|
descriptionTagline for your blog; set in General Options. <?php bloginfo('description'); ?> |
|
urlURL for your blog's web site address. <?php bloginfo('url'); ?> |
|
rdf_urlURL for RDF/RSS 1.0 feed. <?php bloginfo('rdf_url'); ?> |
|
rss_urlURL for RSS 0.92 feed. <?php bloginfo('rss_url'); ?> |
|
rss2_urlURL for RSS 2.0 feed. <?php bloginfo('rss2_url'); ?> |
|
atom_urlURL for Atom feed. <?php bloginfo('atom_url'); ?> |
|
comments_rss2_urlURL for comments RSS 2.0 feed. <?php bloginfo('comments_rss2_url'); ?> |
|
pingback_urlURL for Pingback (XML-RPC file). <?php bloginfo('pingback_url'); ?> |
|
admin_emailAdministrator's email address; set in General Options. <?php bloginfo('admin_email'); ?> |
|
charsetCharacter encoding for your blog; set in Reading Options. <?php bloginfo('charset'); ?> |
|
versionVersion of WordPress your blog uses. <?php bloginfo('version'); ?> |
|
html_type"Content-type" for your blog. <?php bloginfo('html_type'); ?> |
|
wpurlURL for WordPress installation. <?php bloginfo('wpurl'); ?> |
|
template_urlURL for template in use. <?php bloginfo('template_url'); ?> |
|
template_directoryURL for template's directory. <?php bloginfo('template_directory'); ?> |
|
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'); ?> |
|
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().
博客RSSbloginfo_rss();
<?php bloginfo_rss('arguments'); ?>
nameWeblog title; set in General Options. (Default) <?php bloginfo('name'); ?> |
|
descriptionTagline for your blog; set in General Options. <?php bloginfo('description'); ?> |
|
urlURL for your blog's web site address. <?php bloginfo('url'); ?> |
|
rdf_urlURL for RDF/RSS 1.0 feed. <?php bloginfo('rdf_url'); ?> |
|
rss_urlURL for RSS 0.92 feed. <?php bloginfo('rss_url'); ?> |
|
rss2_urlURL for RSS 2.0 feed. <?php bloginfo('rss2_url'); ?> |
|
atom_urlURL for Atom feed. <?php bloginfo('atom_url'); ?> |
|
comments_rss2_urlURL for comments RSS 2.0 feed. <?php bloginfo('comments_rss2_url'); ?> |
|
pingback_urlURL for Pingback (XML-RPC file). <?php bloginfo('pingback_url'); ?> |
|
admin_emailAdministrator's email address; set in General Options. <?php bloginfo('admin_email'); ?> |
|
charsetCharacter encoding for your blog; set in Reading Options. <?php bloginfo('charset'); ?> |
|
versionVersion of WordPress your blog uses. <?php bloginfo('version'); ?> |
|
html_type"Content-type" for your blog. <?php bloginfo('html_type'); ?> |
|
wpurlURL for WordPress installation. <?php bloginfo('wpurl'); ?> |
|
template_urlURL for template in use. <?php bloginfo('template_url'); ?> |
|
template_directoryURL for template's directory. <?php bloginfo('template_directory'); ?> |
|
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'); ?> |
|
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'); ?>
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'); ?> |
|
descriptionthe Tagline set in Administration > Options > General. This data is retrieved from the blogdescription record in the wp_options table. <?php get_bloginfo('description'); ?> |
|
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'); ?> |
|
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'); ?> |
|
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'); ?> |
|
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'); ?> |
|
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'); ?> |
|
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'); ?> |
|
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'); ?> |
|
atom_urlURL for Atom feed which is your Blog address (URI) appended with the string such as /feed/rss. <?php get_bloginfo('atom_url'); ?> |
|
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'); ?> |
|
pingback_urlURL for Pingback (XML-RPC file) which is your Blog address (URI) appended with the string /xmlrpc.php. <?php get_bloginfo('pingback_url'); ?> |
|
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'); ?> |
|
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'); ?> |
|
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'); ?> |
|
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'); ?> |
|
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'); ?> |
|
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'); ?> |
|
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'); ?> |
|
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'); ?> |
|
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'); ?>
nameWeblog title; set in General Options. (Default) <?php get_bloginfo_rss('name'); ?> |
|
descriptionTagline for your blog; set in General Options. <?php get_bloginfo_rss('description'); ?> |
|
urlURL for your blog's web site address. <?php get_bloginfo_rss('url'); ?> |
|
rdf_urlURL for RDF/RSS 1.0 feed. <?php get_bloginfo_rss('rdf_url'); ?> |
|
rss_urlURL for RSS .92 feed. <?php get_bloginfo_rss('rss_url'); ?> |
|
rss2_urlURL for RSS 2.0 feed. <?php get_bloginfo_rss('rss2_url'); ?> |
|
atom_urlURL for Atom feed. <?php get_bloginfo_rss('atom_url'); ?> |
|
comments_rss2_urlURL for comments RSS 2.0 feed. <?php get_bloginfo_rss('comments_rss2_url'); ?> |
|
pingback_urlURL for Pingback (XML-RPC file). <?php get_bloginfo_rss('pingback_url'); ?> |
|
admin_emailAdministrator's email address; set in General Options. <?php get_bloginfo_rss('admin_email'); ?> |
|
charsetCharacter encoding for your blog; set in Reading Options. <?php get_bloginfo_rss('charset'); ?> |
|
versionVersion of WordPress your blog uses. <?php get_bloginfo_rss('version'); ?> |
|
html_type"Content-type" for your blog. <?php get_bloginfo_rss('html_type'); ?> |
|
wpurl"Content-type" for your blog. <?php get_bloginfo_rss('html_type'); ?> |
|
wpurl"Content-type" for your blog. <?php get_bloginfo_rss('html_type'); ?> |
|
template_urlURL for template in use. <?php get_bloginfo_rss('template_url'); ?> |
|
template_directoryURL for template's directory. <?php get_bloginfo_rss('template_directory'); ?> |
|
stylesheet_urlURL for primary CSS file. <?php get_bloginfo_rss('stylesheet_url'); ?> |
|
stylesheet_directoryURL for stylesheet directory. <?php get_bloginfo_rss('stylesheet_directory'); ?> |
|
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.
页面标题wp_title();
<?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'); ?> |
|
echoEcho the title (True) or return the title for use as a PHP string (False). <?php wp_title('sep', 1, 'seplocation'); ?> |
|
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'); ?> |
|
Displays or returns the title of the page.
获得文章get_posts;
<?php get_posts('arguments'); ?>
numberpostsNumber of posts to return. <?php get_posts('numberposts=10'); ?> |
|
offsetOffset from latest post. <?php get_posts('offset=1'); ?> |
|
categoryOnly show posts from this category ID. <?php get_posts('category=2'); ?> |
|
orderbySort posts by one of various values <?php get_posts('orderby=post_name'); ?> |
|
orderHow to sort 'orderby'. <?php get_posts('order=DESC'); ?> |
|
includeThe IDs of the posts you want to show, separated by commas and/or spaces. <?php get_posts('include=62'); ?> |
|
excludeThe IDs of any posts you want to exclude, separated by commas and/or spaces <?php get_posts('exclude=62'); ?> |
|
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'); ?> |
|
post_typeThe type of post to show. <?php get_posts('post_type=page'); ?> |
|
post_statusShow posts with a particular status. <?php get_posts('post_status=draft'); ?> |
|
post_parentShow only the children of the post with this ID <?php get_posts('post_parent=7'); ?> |
|
This is a simple tag for creating multiple loops.
存档清单wp_get_archives();
<?php wp_get_archives('arguments'); ?>
typeThe type of archive list to display. Defaults to WordPress settings. <?php wp_get_archives('type=yearly'); ?> |
|
limitNumber of archives to get. Default is no limit. <?php wp_get_archives('limit=5'); ?> |
|
formatFormat for the archive list. <?php wp_get_archives('format=link'); ?> |
|
beforeText to place before the link when using the html or custom for format option. There is no default. <?php wp_get_archives('before=»'); ?> |
|
afterText to place after the link when using tge html or custom for format option. There is no default. <?php wp_get_archives('after=«'); ?> |
|
show_post_countDisplay number of posts in an archive. <?php wp_get_archives('show_post_count=1'); ?> |
|
This function displays a date-based archives list.
页面链接清单wp_list_pages();
<?php wp_list_pages('arguments'); ?>
sort_columnSorts the list of Pages in a number of different ways. <?php wp_list_pages('sort_column=ID'); ?> |
|
sort_orderChange the sort order of the list of Pages (either ascending or descending). <?php wp_list_pages('sort_order=desc'); ?> |
|
excludeDefine a comma-separated list of Page IDs to be excluded from the list <?php wp_list_pages('exclude=62'); ?> |
|
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'); ?> |
|
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'); ?> |
|
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'); ?> |
|
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'); ?> |
|
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'); ?> |
|
title_liSet the text and style of the Page list's heading. <?php wp_list_pages('title_li=Page List'); ?> |
|
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'); ?> |
|
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'); ?> |
|
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'); ?> |
|
The Template Tag, wp_list_pages(), displays a list of WordPress Pages as links.
Page Dropdownwp_dropdown_pages();
<?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'); ?> |
|
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'); ?> |
|
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'); ?> |
|
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'); ?> |
|
nameName assigned to the dropdown form. Defaults to 'page_id'. <?php wp_dropdown_pages('name=page-id'); ?> |
|
show_option_noneCauses the HTML for the dropdown to allow you to select NONE of the pages. <?php wp_dropdown_pages('show_option_none='); ?> |
|
excludeComma separated list of category IDs to exclude. <?php wp_dropdown_pages('exclude=7,3'); ?> |
|
Displays a list of pages in a select (i.e dropdown) box with no submit button.
登陆/登出的链接wp_loginout();
<?php wp_loginout(); ?>
|
Displays a login link, or if a user is logged in, a logout link.
注册/管理的连接wp_register();
<?php wp_register('before', 'after'); ?>
beforeText to display before the Register or Site Admin link. Default is '<li>'. <?php wp_register('»', 'after'); ?> |
|
afterText to display after the Register or Site Admin link. Default is '</li>'. <?php wp_register('before', '«'); ?> |
|
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_posts();
<?php query_posts('parameters'); ?>
catDisplay the posts from one or more category ID's. <?php query_posts('cat=7'); ?> |
|
category_nameDisplay posts with a certain category name. <?php query_posts('category_name=Sports'); ?> |
|
tagShow posts associated with certain tags. <?php query_posts('tag=basketball'); ?> |
|
author_nameShow posts by an author with a certain name. <?php query_posts('author_name=Chase'); ?> |
|
authorShow posts by an author with a certain ID. <?php query_posts('author=3'); ?> |
|
pUse the post ID to show the first post. <?php query_posts('p=9'); ?> |
|
nameUse the post slug to show the first post. <?php query_posts('name=chase-crawford'); ?> |
|
page_idShow posts from a page with a certain ID. <?php query_posts('page_id=11'); ?> |
|
pagenameShow posts from this page with a certain name. <?php query_posts('pagename=about'); ?> |
|
showpostsShow a limited amount of posts. <?php query_posts('showposts=11'); ?> |
|
hourShow post belonging to this hour. <?php query_posts('hour=12'); ?> |
|
minuteShow posts belonging to this minute. <?php query_posts('minutes=33'); ?> |
|
secondShow posts belonging to this second. <?php query_posts('second=59'); ?> |
|
dayShow posts belonging to this day. <?php query_posts('day=14'); ?> |
|
monthnumShow posts belonging to this month. <?php query_posts('monthnum=6'); ?> |
|
yearShow posts belonging to this year. <?php query_posts('year=2003'); ?> |
|
pagedshow the posts that would normally show up just on page 2 when using the "Older Entries" link. <?php query_posts('paged=3'); ?> |
|
posts_per_pagenumber of posts to show per page; a value of -1 will show all posts. <?php query_posts('post_per_page=5'); ?> |
|
orderWhat order to display posts in. <?php query_posts('order=ASC'); ?> |
|
offsetDisplaces or passes over one or more initial posts which would normally be collected by your query. <?php query_posts('offset=1'); ?> |
|
orderbySort retrieved posts by this field. <?php query_posts('orderby=title'); ?> |
|
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(); ?>
|
Transforms links to audio or video files in a post into RSS enclosures. Used for Podcasting.
标签wp_tag_cloud();
<?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.
调用搜索the_search_query();
<?php the_search_query(''); ?>
|
Displays the search query for the current request, if a search was made.
链接 模板函数
'修改文章'链接edit_post_link();
<?php edit_post_link('link', 'before', 'after'); ?>
linkThe link text. Defaults to 'Edit This'. <?php edit_post_link('Edit', 'before', 'after'); ?> |
|
beforeText to put before the link text. There is no default. <?php edit_post_link('link', '»', 'after'); ?> |
|
afterText to put after the link text. There is no default. <?php edit_post_link('link', 'before', '«'); ?> |
|
Displays a link to edit the current post, if a user is logged in and allowed to edit the post.
'修改评论'链接edit_comment_link();
<?php edit_comment_link('link', 'before', 'after'); ?>
linkThe link text. Defaults to 'Edit This'. <?php edit_post_link('Edit', 'before', 'after'); ?> |
|
beforeText to put before the link text. There is no default. <?php edit_post_link('link', '»', 'after'); ?> |
|
afterText to put after the link text. There is no default. <?php edit_post_link('link', 'before', '«'); ?> |
|
Displays a link to edit the current comment, if the user is logged in and allowed to edit the comment.
页面链接wp_page_links();
<?php wp_page_links('arguments'); ?>
beforeText to put before all the links. Defaults to <p>Pages: <?php wp_page_links('before=<div>'); ?> |
|
afterText to put after all the links. Defaults to </p>. <?php wp_page_links('after=</div>'); ?> |
|
next_or_numberIndicates whether page numbers should be used. <?php wp_page_links('next_or_number=next'); ?> | |
| |
nextpagelinkText for link to next page. Defaults to Next page. <?php wp_page_links('nextpagelink=Next'); ?> |
|
previouspagelinkText for link to previous page. Defaults to Previous page. <?php wp_page_links('previouspagelink=Previous'); ?> |
|
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=[%]'); ?> |
|
more_filePage the links should point to. Defaults to the current page. <?php wp_page_links('more_file=more.php'); ?> |
|
Displays page-links for paginated posts.
年存档链接get_year_link();
<?php get_year_link('year'); ?>
yearThe year for the archive. Use '' to assign current year. <?php get_year_link('2003'); ?> |
|
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.
月存档链接get_month_link();
<?php get_month_link('year','month'); ?>
yearThe year for the archive. Use '' to assign current year. <?php get_month_link('2003','month'); ?> |
|
monthThe month for the archive. Use '' to assign current month. <?php get_month_link('year','10'); ?> |
|
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.
日存档链接get_day_link();
<?php get_day_link('year','month','day'); ?>
yearThe year for the archive. Use '' to assign current year. <?php get_day_link('2003','month','day'); ?> |
|
monthThe month for the archive. Use '' to assign current month. <?php get_day_link('year','10','day'); ?> |
|
dayThe day for the archive. Use '' to assign current day. <?php get_day_link('year','month','23'); ?> |
|
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.
上一篇文章链接next_posts_link();
<?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.
永久链接 模板函数
Permalink Anchorpermalink_anchor();
<?php permalink_anchor('type'); ?>
typeType of anchor to output. <?php permalink_anchor('type=title'); ?> |
|
Outputs a permalink anchor identifier or id (<a id="....) for a post.
Permalink (PHP)get_permalink();
<?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); ?> |
|
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(); ?>
|
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'); ?>
fileThe page the link should point to. Defaults to the current page. <?php permalink_single_rss('index.php'); ?> |
|
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.
文章 模板函数
文章IDthe_ID();
<?php the_ID(); ?>
|
Displays the numeric ID of the current post.
文章标题the_title();
<?php the_title(); ?>
beforeText to place before the title. Defaults to ''. <?php the_title("before=»"); ?> |
|
afterText to place after the title. Defaults to ''. <?php the_title("after=«"); ?> |
|
displayDisplay the title (TRUE) or return it for use in PHP (FALSE). <?php the_title("display=FALSE"); ?> |
|
Displays or returns the title of the current post.
Post Title (Attribute)the_title_attribute();
<?php the_title_attribute('arguments'); ?>
beforeText to place before the title. Defaults to ''. <?php the_title("before=»"); ?> |
|
afterText to place after the title. Defaults to ''. <?php the_title("after=«"); ?> |
|
echoDisplay the title (1) or return it for use in PHP (0). <?php the_title("echo=0"); ?> |
|
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_title();
<?php single_post_title('prefix', display); ?>
prefixText to place before the title. Defaults to ''. <?php single_post_title('•', display); ? |
|
displayShould the title be displayed (TRUE) or returned for use in PHP (FALSE). <?php single_post_title('prefix', TRUE); ? |
|
Displays or returns the title of the post when on a single post page (permalink page).
文章标题RSSthe_title_rss();
<?php the_title_rss(); ?>
|
Displays the title of the current post, formatted for RSS. This tag must be within The Loop.
文章全文the_content();
<?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'); ?> |
|
strip_teaserShould the text before the "more" link be hidden (TRUE) or displayed (FALSE). <?php the_content('more_link_text', TRUE, 'more_file'); ?> |
|
more_fileFile the "more" link points to. Defaults to the current file. <?php the_content('more_link_text', strip_teaser, 'more.php'); ?> |
|
Displays the contents of the current post. This tag must be within The_Loop.
文章全文RSSthe_content_rss();
<?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; ?> |
|
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; ?> |
|
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; ?>> |
|
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; ?>> |
|
encode_htmlDefines html tag filtering and special character (e.g. '&') encoding. <?php the_content_rss('more_link_text', strip_teaser, 'more_file'),cut, 1; ?>> |
|
Displays the content of the current post formatted for RSS. This tag must be within The_Loop.
文章简介the_excerpt();
<?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.
文章简介RSSthe_excerpt_rss();
<?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.
上篇文章链接previous_post_link();
<?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'); ?> |
|
linkLink text to display. Defaults to previous post's title ('%title'). <?php previous_post_link('format', 'Previous Post', in_same_cat, 'excluded_categories'); ?> |
|
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'); ?> |
|
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'); ?> |
|
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_link();
<?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'); ?> |
|
linkLink text to display. Defaults to next post's title ('%title'). <?php next_post_link('format', 'Next Post', in_same_cat, 'excluded_categories'); ?> |
|
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'); ?> |
|
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'); ?> |
|
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'); ?>
sepText displayed between the links. <?php posts_nav_link(',','prelabel','nxtlabel'); ?> |
|
prelabelLink text for the previous page. <?php posts_nav_link('sep','»','nxtlabel'); ?> |
|
nxtlabelLink text for the next page. <?php posts_nav_link('sep','prelabel','«'); ?> |
|
Displays links for next and previous pages. Useful for providing "paged" navigation of index, category and archive pages.
Post Metathe_meta();
<?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.
文章标签the_tags();
<?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'); ?> |
|
seperatorText or character to display between each tag link. The default is a comma (,) between each tag. <?php the_tags('before', '|', 'after'); ?> |
|
afterText to display after the last tag. The default is to display nothing. <?php the_tags('before', 'separator', '.'); ?> |
|
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.
文章数目wp_count_posts();
<?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'); ?> |
|
statusStatus of row in wp_posts to count where status is equal to post_status. <?php wp_count_posts('type', 'draft'); ?> |
|
Returns the count of the rows in wp_posts that meet the post_type and post_status designated.
标签 模板函数
标签云wp_tag_cloud();
<?php wp_tag_cloud(); ?>
smallestThe text size of the tag with the smallest count value (units given by unit parameter). <?php wp_tag_cloud(); ?> |
|
largestThe text size of the tag with the highest count value (units given by the unit parameter). <?php wp_tag_cloud(); ?> |
|
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(); ?> |
|
numberThe number of actual tags to display in the cloud. (Use '0' to display all tags.) <?php wp_tag_cloud(); ?> |
|
formatFormat of the cloud display. <?php wp_tag_cloud(); ?> |
|
orderbyOrder of the tags. <?php wp_tag_cloud(); ?> |
|
orderSort order. <?php wp_tag_cloud(); ?> |
|
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(); ?> |
|
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(); ?> |
|
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.
文章标签get_the_tags();
<?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..
标签清单get_the_tag_list();
<?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.
Tag Title for Current Pagesingle_tag_title();
<?php single_tag_title('prefix', 'display'); ?>
prefixText to output before the tag title. <?php single_tag_title('Tag:', 'display'); ?> |
|
displayDisplay the tag's title (TRUE) or return it for use in PHP (FALSE). <?php single_tag_title('prefix', 'TRUE'); ?> |
|
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.