List of Conditional Tags
Warning: You can only use conditional query tags after the WP_Query is set up or with an action hook.
Complete List of Conditional Tags
- is_front_page()
- is_home()
- is_front_page()
- is_home()
- is_admin()
- is_network_admin()
- is_admin_bar_showing()
- is_single()
- is_sticky()
- is_post_type_hierarchical( $post_type )
- is_post_type_archive()
- is_comments_popup()
- comments_open()
- pings_open()
- is_page()
- is_page_template()
- is_category( $category )
- is_tag()
- is_tax()
- has_term()
- term_exists( $term, $taxonomy, $parent )
- is_taxonomy_hierarchical( $taxonomy )
- taxonomy_exists( $taxonomy )
- is_author()
- is_date()
- is_year()
- is_month()
- is_day()
- is_time()
- is_new_day()
- is_archive()
- is_search()
- is_404()
- is_paged()
- is_attachment()
- wp_attachment_is_image( $post_id )
- is_local_attachment( $url )
- is_singular()
- post_type_exists( $post_type )
- is_main_query()
- is_new_day()
- is_feed()
- is_trackback()
- is_preview()
- in_the_loop()
- is_dynamic_sidebar()
- is_active_sidebar()
- is_active_widget( $widget_callback, $widget_id )
- is_blog_installed()
- is_rtl()
- is_multisite()
- is_main_site()
- is_super_admin()
- is_user_logged_in()
- email_exists( $email )
- username_exists( $username )
- is_plugin_active( $path )
- is_plugin_inactive( $path )
- is_plugin_active_for_network( $path )
- is_plugin_page()
- is_child_theme()
- current_theme_supports()
- has_post_thumbnail( $post_id )
- wp_script_is( $handle, $list )
The Conditions For …
All of the Conditional Tags test to see whether a certain condition is met, and then returns either TRUE or FALSE. The conditions under which various tags output TRUE is listed below. Those tags which can accept parameters are so noted.
The Main Page
The Front Page
The Blog Page
A Single Post Page
A PAGE Page
Has Post Thumbnail
A Single Page, a Single Post, an Attachment or Any Other Custom Post Type
A Category Page
A Tag Page
A Taxonomy Page (and related)
- is_tax()
- has_term()
- term_exists( $term, $taxonomy, $parent )
- is_taxonomy_hierarchical( $taxonomy )
- taxonomy_exists( $taxonomy )
An Author Page
A Date Page
Any Archive Page
A Search Result Page
A 404 Not Found Page
Is Dynamic SideBar
Is Sidebar Active
Is Widget Active
Is User Logged in
Email Exists
Username Exists
A Paged Page
Right To Left Reading
An Attachment
Attachment Is Image
A Local Attachment
Post Type Exists
Is Main Query
A New Day
A Syndication
A Trackback
A Preview
Has An Excerpt
Has A Nav Menu Assigned
Is Blog Installed
Part of a Network (Multisite)
An Active Plugin
- is_plugin_active( $path )
- is_plugin_inactive( $path )
- is_plugin_active_for_network( $path )
- is_plugin_page()
A Child Theme
Theme supports a feature
Is Previewed in the Customizer
这篇文档对你有帮助吗?
谢谢你的反馈!