Return to Snippet

Revision: 27999
at June 29, 2010 03:00 by jonkemp


Initial Code
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
}

Initial URL
http://codex.wordpress.org/Conditional_Tags

Initial Description
Reference for WordPress conditional tags with code example.

Initial Title
WordPress Conditional Tags

Initial Tags
php, wordpress

Initial Language
PHP