|
======= admin |
|
|
|
is_admin() - admin page, not public |
|
|
|
======= posts and pages etc |
|
|
|
is_home() - main blog page with latest posts (not necessarily front page) |
|
is_front_page() - front of site (latest posts OR static page, see settings) |
|
|
|
is_single() - single post/attachement/cpt (=custom post type), NOT for pages |
|
is_single( '17' ) |
|
is_single( 'Beef Stew' ) |
|
is_single( 'beef-stew' ) ID, title, slug |
|
is_single( array( 17, 'beef-stew', 'Irish Stew' ) ) - any of these |
|
|
|
is_singular() - single post/attachement/cpt or PAGE |
|
is_singular( 'book' ) |
|
is_singular( array( 'newspaper', 'book' ) ) |
|
|
|
is_page() |
|
is_page( 42 ) |
|
is_page( 'About Me And Joe' ) |
|
is_page( 'about-me' ) |
|
is_page( array( 42, 'about-me', 'About Me And Joe' ) ) |
|
|
|
======= archives, taxonomies |
|
|
|
is_archive() - archive page of category, tag, author, date - but NOT cpt |
|
|
|
is_category() - any category ARCHIVE page (not single) |
|
is_category( '9' ) |
|
is_category( 'Stinky Cheeses' ) |
|
is_category( 'blue-cheese' ) ID, title, slug |
|
is_category( array( 9, 'blue-cheese', 'Stinky Cheeses' ) ) |
|
|
|
in_category( '5' ) - post is IN this category |
|
in_category( array( 1,2,3 ) ) |
|
|
|
is_tag() - tag archive page |
|
is_tag( 'mild' ) - tag archive of this tag (slug) |
|
is_tag( array( 'sharp', 'mild', 'extreme' ) ) - any of these |
|
|
|
has_tag() - post has a tag (must be inside The loop |
|
has_tag( 'mild' ) |
|
has_tag( array( 'sharp', 'mild', 'extreme' ) ) - post has any of these tags |
|
|
|
is_tax() - any custom taxonomy archive page (NOT category, tag) |
|
is_tax( 'flavor' ) |
|
is_tax( 'flavor', 'mild') - archive of "flavor" taxonomy with slug "mild" displayed |
|
is_tax( 'flavor', array( 'sharp', 'mild', 'extreme' ) ) |
|
|
|
has_term() |
|
has_term( 'green', 'color' ) - current post has term "green" from taxonomy "color" |
|
has_term( 'green', 'color', 'other post' ) |
|
taxonomy_exists() |
|
|
|
is_author() - an author page |
|
is_author( '4' ) |
|
is_author( 'Vivian' ) |
|
is_author( 'john-jones' ) |
|
is_author( array( 4, 'john-jones', 'Vivian' ) ) |
|
is_multi_author( ) - site with more than one author |
|
|
|
is_date() - any date archive |
|
is_year() |
|
is_month() |
|
is_day() |
|
is_time() |
|
is_new_day() |
|
|
|
is_post_type_archive() - any custom post type archive (cpt) |
|
is_post_type_archive( 'book' ) |
|
|
|
is_post_type_hierarchical() - if this post type has hierarchical support |
|
is_post_type_hierarchical( 'book' ) |
|
|
|
get_post_type() - returns the registered post type of post, cpt, eg with |
|
if ( 'book' == get_post_type() ) etc |
|
post_type_exists() - true if given post type is a registered post type |
|
|
|
========= special pages |
|
|
|
is_search() - search result page |
|
is_404() |
|
is_attachment() |
|
is_preview() |
|
|
|
========= other |
|
|
|
is_paged() - paged page (split into several pages) |
|
is_sticky() - for current post |
|
is_sticky( '17' ) |
|
has_excerpt() - for current post |
|
has_excerpt( '42' ) (or just 42 ?) |
|
|
|
is_page_template() - is a page template being used |
|
is_page_template( 'about.php' ) - uses this template |
|
|
|
is_comments_popup() |
|
comments_open() |
|
pings_open() |
|
|
|
has_nav_menu( 'mylocation' ) - has menu assigned |
|
in_the_loop() - whether you are inside the loop (for plugins) |
|
is_active_sidebar( 'sidebar-primary' ) - ID, name, slug |
|
|
|
is_multisite() |
|
is_main_site() |
|
is_super_admin() |
|
|
|
is_plugin_active('plugin-directory/plugin-file.php') - in admin only (or see example) |
|
|
|
is_child_theme() - whether a child theme is in use |
|
current_theme_supports( 'custom-header' ) - or custom bg, thumbnails, menus, editor styles, widgets, automatic feed link |