WordPress template page judgment Function

Source: Internet
Author: User

Index page Homepage
Is_home ()
Determines whether it is a homepage.

The front page homepage message settings
Is_front_page ()
Determine whether it is a front page message. (log or page ). when the system displays the blog homepage and the settings on the Management Panel> read the menu, set the "homepage as" option to "recently published articles ", or the is_front_page () label returns true if the "Homepage" option is set to "and" Homepage "is the currently displayed page under the" Settings> Read menu.

The Administration panels Management Control Panel
Is_admin ()
Determine whether it is a background management control panel.

A single post page single log
Is_single ()
Determine whether it is any single log.
Is_single ('17 ′)
Determine whether it is a single log of id17.
Is_single ('Irish stew ')
Determine whether a single log is titled "Irish stew.
Is_single ('beef-stew ')
Determine whether the log is an alias of "beef-stew.
Is_single (Array (17, 'beef-stew', 'Irish stew '))
Determine whether it is id17, "beef-stew", or a single log titled "Irish stew.
Is_single (Array (17, 19, 1, 11 ))
Judge whether it is an article of ID 17, 19, 1, 11.
Is_single (Array ('beef-stew', 'pea-soup', 'chili '))
Determine if the alias is "beef-stew", and the alias is "pea-soup" or a single log with the alias "chili.
Is_single (Array ('beef stew', 'pea soup', 'chili '))
Determine whether a single log is titled "beef stew" and titled "pea soup" or "chili.

A sticky post pin post
Is_sticky ()
Determine whether it is a top article.
Is_sticky ('17 ′)
Determines whether it is the top article of id17.

A comments popup comment pop-up window
Is_comments_popup ()
Determines whether the comment is in the pop-up window.

Any page containing posts comments
Comments_open ()
Judge whether the current article allows comments.
Pings_open ()
Determines whether the current article allows pingback ).

A page
Is_page ()
Determine whether there are any pages.
Is_page ('42 ′)
Page for determining whether the ID is 42.
Is_page ('about me and job ')
Determines whether the page is titled "about me and Joe.
Is_page ('about-Me ')
Determines whether the page is alias "about-me.
Is_page (Array (42, 'about-me', 'about me and job '))
Determine whether it is ID 42, the alias "about-me", or the page titled "about me and Joe.

A category page category Archiving
Is_category ()
Determines if it is any category page.
Is_category ('9 ′)
CATEGORY page for determining whether it is id9.
Is_category ('stinky chees ')
Determines whether the archive page is named "stinky cheeses.
Is_category ('blue-cheese ')
Determines whether the alias is a "blue-cheese" category archive page.
Is_category (Array (9, 'blue-chees', 'stinky chees '))
Determine whether the ID is 9, the alias is "blue-cheese", or the category archive page named "stinky cheeses.
In_category ('5 ′)
Judge whether the category ID of the current article is 5
In_category (Array (1, 2, 3 ))
Determines whether the classification ID of the current article is 1, 2, or 3.
! In_category (Array (4, 5, 6 ))
Determines whether the category ID of the current article is not 4, 5, or 6.

A tag page tag Archiving
Is_tag ()
Determines whether it is a tab
Is_tag ('mild ')
The tag archive page that determines whether it is an alias 'mild.
Is_tag (Array ('sharp ', 'mild', 'extreme '))
Determines whether the alias is a "sharp", "mild", or "extreme" tag archive page.
Has_tag ()
Determine whether the current article has tags.
Has_tag ('mild ')
Judge whether the current article has the tag 'mild '.
Has_tag (Array ('sharp ', 'mild', 'extreme '))
Determines whether the current article contains tags in an array.

An author page author Archive
Is_author ()
Determine whether the archive page is the author.
Is_author ('4 ′)
The author's archive page for determining whether it is id4.
Is_author ('vivian ')
The author archive page that determines whether it is nicknamed "Vivian.
Is_author ('John-Jones ')
Determines whether it is the author archive page nicknamed "John-Jones.
Is_author (Array (4, 'John-Jones ', 'vivianc '))
Determine whether it is ID 4, "John-Jones", or the author tab with the nickname "Vivian.

A date page date archiving page
Is_date ()
Determines whether it is a date archiving page.
Is_year ()
Determines whether the archive page is by year.
Is_month ()
When a monthly archive is being displayed.
Is_day ()
Determines whether the page is archived by day.
Is_time ()
Determines whether the archive page is archived by hour, minute, or second.

Any archive page
Is_archive ()
Whether to archive the page.

A search result page

Is_search ()
Whether to search pages.

A 404 Not found page not found page

Is_404 ()
Whether the page is 404.

A paged page
Is_paged ()
Determine whether there is a page. You need to <! -Nextpage-> insert a quick tag to an article to split the article into multiple pages.

An attachment
Is_attachment ()
Determine whether the file is an attachment. the attachment is an image or other File Uploaded through the editor upload tool. The attachment can be displayed on the corresponding page or template.

A single page, single post or attachment independent page, single log or attachment
Is_feed ()
When a website needs to use RSS to subscribe, is_feed () returns true. Generally, the is_feed () tag is used by WordPress system and plug-in developers, and the is_feed () tag is rarely used by common Wordpress users.

A trackback reference notification
Is_trackback ()
The website needs to hook the WordPress hook into trackback. The WordPress system and plug-in developers usually use this tag, and the is_feed () tag is rarely used by common Wordpress users.

A preview draft Preview
Is_preview ()
Determine whether the article is displayed in draft Preview mode.

Has an excerpt Abstract
Has_excerpt ()
Determine whether the current article has a summary.
Has_excerpt ('42 ′)
Judge whether the id42 article has a summary.

Inside the loop
In_the_loop ()
Determine whether the tag is in the WordPress main loop. This tag applies to plug-in developers. If the tag is currently in the WordPress main loop, true is returned.

Is sidebar active sidebar
Is_active_sidebar ()
Check whether the existing sidebar is activated (Enabled). If the sidebar is enabled, is_active_sidebar () returns true; otherwise, false.

Address: http://www.mangostudio.net/archives/52

WordPress template page judgment Function

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.