PHP WordPress条件标签

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了PHP WordPress条件标签相关的知识,希望对你有一定的参考价值。

if ( comments_open() ) {
    // When comments are allowed
} elseif ( has_excerpt() ) {
	// When the current post has an excerpt
} elseif ( has_tag() ) {
	// When the current post has a tag
} elseif ( in_category('n') ) {
	// Returns true if the current post is in the specified category 'n'
} elseif ( is_404() ) {
	// When a "HTTP 404: Not Found" error occurs
} elseif ( is_admin() ) {
	// When the Dashboard or the administration panels are being displayed
} elseif ( is_archive() ) {
	// When any type of Archive page is being displayed
} elseif ( is_attachment() ) {
	// When an attachment document to a post or Page is being displayed
} elseif ( is_author() ) {
	// When any Author page is being displayed
} elseif ( is_category() ) {
	// When any Category archive page is being displayed
} elseif ( is_comments_popup() ) {
	// When in Comments Popup window
} elseif ( is_date() ) {
	// When any date-based archive page is being displayed
} elseif ( is_day() ) {
	// When a daily archive is being displayed
} elseif ( is_feed() ) {
	// When the site requested is a Syndication
} elseif ( is_front_page() ) {
    // When it is the front of the site displayed
} elseif ( is_home() ) {
    // When it is the front of the site displayed
} elseif ( is_month() ) {
	// When a monthly archive is being displayed
} elseif ( is_page() ) {
	// When any Page is being displayed
} elseif ( is_page_template() ) {
	// Is a Page Template being used
} elseif ( is_paged() ) {
	// When the page being displayed is "paged"
} elseif ( is_preview() ) {
	// When a single post being displayed is viewed in Draft mode
} elseif ( is_search() ) {
	// When a search result page archive is being displayed
} elseif ( is_single() ) {
	// When any single Post (or attachment, or custom Post Type) page is being displayed
} elseif ( is_singular() ) {
	// When any of the following return true: is_single(), is_page()  or is_attachment()
} elseif ( is_sticky() ) {
	// Returns true if "Stick this post to the front page" check box has been checked for the current post
} elseif ( is_tag() ) {
	// When any Tag archive page is being displayed
} elseif ( is_tax() ) {
	// When any Taxonomy archive page is being displayed
} elseif ( is_time() ) {
	// When an hourly, "minutely", or "secondly" archive is being displayed
} elseif ( is_trackback() ) {
	// When the site requested is WordPress' hook into its Trackback engine
} elseif ( is_year() ) {
	// When a yearly archive is being displayed
} elseif ( pings_open () ) {
	// When pings are allowed for the current Post
}

以上是关于PHP WordPress条件标签的主要内容,如果未能解决你的问题,请参考以下文章

WordPress基础知识:条件判断标签及用法大全

PHP 显示WordPress标签或标签云

板邓:wordpress标签调用函数大全

php 标签链接发布wordpress

php Wordpress自动P标签修复

php WordPress - 搜索标签和标题