Last active
June 16, 2022 06:04
-
-
Save bagerathan/85bb26dc9264126ff328e6c398480b55 to your computer and use it in GitHub Desktop.
[WordPress conditions] #wp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
is_home() //Checks if the blog post index is being displayed. This may or may not be your home page as well. | |
is_front_page() //Checks if your home page is being displayed. This works whether your front page settings are set up to display blog posts (i.e. blog index) or a static page. | |
is_single() //Checks to see whether any type of single post is being displayed (excluding attachments). | |
is_attachment() //Checks if an attachment is displayed. | |
is_page() //Checks if a page is being displayed. | |
is_singular() //Checks whether a single post, attachment or page is being displayed. True is returned if either of those conditions are met. | |
is_category() //Checks whether a category archive page is being displayed. | |
is_search() //Checks if a search results page is being shown. | |
is_tag() //Checks whether a tag archive is being displayed. | |
is_author() //Checks if an author archive page is being displayed. | |
is_archive() //Checks if any type of archive page is being displayed including category, tag, date and author archives. | |
is_sticky() //Checks if a post has been defined as sticky. | |
is_multi_author() //Checks if more than one author has published posts on the website. True is returned if two or more people have published posts. If only one author has published posts, or if no posts have been published at all, false is returned. | |
is_date() //Checks if it is a date based archive page. | |
is_year() //Checks if it is a year based archive page. | |
is_month() //Checks if it is a month based archive page. | |
is_day() //Checks if it is a day based archive page. | |
is_time() //Checks if it is a time based archive page. | |
is_new_day() //Checks if today is a new day. If the current post was published on a different day from the previous post that was published, it would return true. False will be returned if both posts were published on the same day. | |
is_tax() //Checks whether a custom taxonomy archive page is displayed. | |
has_term() //Checks if the current post has one of the specified terms. | |
taxonomy_exists() //Checks if the taxonomy name exists. | |
post_type_exists() //Checks if a post type exists. | |
is_post_type_hierarchical( $post_type ) //Checks if the post type is hierarchical. | |
is_post_type_archive() //Checks if the archive page of a specific post type is being displayed. | |
is_comments_popup() //Checks to see if the comments popup window is open. | |
comments_open() //Checks whether comments are permitted for the current post or page. | |
pings_open() //Checks if pings are permitted for the current post or page. | |
is_feed() //Checks whether the current query is for a feed. | |
is_404() //Checks whether a 404 error is being displayed. | |
is_paged() //Checks whether the page you are currently viewing is a paginated page other than page one. Posts and pages are paginated when you use the nextpage quicktag in your content to split up large posts. | |
is_trackback() //Checks whether a trackback is being used. | |
is_admin() //Checks whether the user is logged into the administrator area. It is not used to check whether a user has administrator privileges, only whether they are logged into the WordPress dashboard. | |
is_page_template() //Checks whether the page being viewed is using a page template. A specific page template can be defined, if necessary. | |
is_preview() //Checks whether a blog post is being viewed in draft mode. | |
has_excerpt() //Checks whether the current post has an excerpt. Specific posts can be defined. | |
has_nav_menu() //Checks whether a menu location has a menu assigned. This is used by theme developers to show something in the event that the user has not added a menu. | |
in_the_loop() //Checks whether the caller is still within the WordPress loop. | |
is_active_sidebar( $index ) //Checks if a given sidebar is being used. | |
is_multisite() //Checks if multisite is supported. | |
is_main_site() //Checks if a multisite is the main site in the network. | |
is_super_admin() //Checks if a user is a super admin within the network. | |
is_plugin_active( $plugin ) //Checks whether a plugin is activated. | |
is_child_theme() //Checks if a child theme is being used. | |
current_theme_supports( $feature ) //Checks if a theme supports a specific feature such as post formats or featured images. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment