Instantly share code, notes, and snippets.
Last active
October 7, 2020 12:48
-
Star
(1)
1
You must be signed in to star a gist -
Fork
(0)
0
You must be signed in to fork a gist
-
Save Aeonexe/52f7f053a1afa5117c16a03f5f76fda2 to your computer and use it in GitHub Desktop.
Wordpress referencia de tags condicionales
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
// A Single Post Page | |
is_single() | |
is_single( '17' ) | |
is_single( 'Irish Stew' ) | |
is_single( 'beef-stew' ) | |
is_single( array( 17, 'beef-stew', 'Irish Stew' ) ) | |
is_single( array( 17, 19, 1, 11 ) ) | |
is_single( array( 'beef-stew', 'pea-soup', 'chili' ) ) | |
is_single( array( 'Beef Stew', 'Pea Soup', 'Chili' ) ) | |
// A Single Page, a Single Post, an Attachment or Any Other Custom Post Type | |
is_singular() | |
is_singular( 'foo' ) | |
is_singular( array( 'foo', 'bar', 'baz' ) ) | |
// A Sticky Post | |
is_sticky() | |
is_sticky( '17' ) | |
// A Post Type is Hierarchical | |
is_post_type_hierarchical( $post_type ) | |
is_post_type_hierarchical( 'book' ) | |
//A Post Type Archive | |
is_post_type_archive() | |
is_post_type_archive( $post_type ) | |
is_post_type_archive( array( 'foo', 'bar', 'baz' ) ) | |
// A Comments Popup | |
is_comments_popup() | |
comments_open() | |
pings_open() | |
// A PAGE Page | |
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' ) ) | |
is_page( array( 42, 54, 6 ) ) | |
// Subpage | |
if ( is_page() && $post->post_parent > 0 ) { | |
// Contenido | |
} | |
// Is a Page Template | |
is_page_template() | |
is_page_template( 'about.php' ) | |
// A Category Page | |
is_category( $category ) | |
is_category( '9' ) | |
is_category( 'Stinky Cheeses' ) | |
is_category( 'blue-cheese' ) | |
is_category( array( 9, 'blue-cheese', 'Stinky Cheeses' ) ) | |
is_category( 5 ) || cat_is_ancestor_of( 5, get_query_var( 'cat' ) ) | |
in_category( '5' ) | |
in_category( array( 1,2,3 ) ) | |
! in_category( array( 4,5,6 ) ) | |
// A Tag Page | |
is_tag() | |
is_tag( 'mild' ) | |
is_tag( array( 'sharp', 'mild', 'extreme' ) ) | |
has_tag() | |
has_tag( 'mild' ) | |
has_tag( array( 'sharp', 'mild', 'extreme' ) ) | |
//A Taxonomy Page (and related) | |
is_tax | |
is_tax() | |
is_tax( 'flavor' ) | |
is_tax( 'flavor', 'mild') | |
is_tax( 'flavor', array( 'sharp', 'mild', 'extreme' ) ) | |
// has_term | |
has_term() | |
has_term( 'green', 'color' ) | |
has_term( array( 'green', 'orange', 'blue' ), 'color' ) | |
// term_exists | |
term_exists( $term, $taxonomy, $parent ) | |
// is_taxonomy_hierarchical | |
is_taxonomy_hierarchical( $taxonomy ) | |
// taxonomy_exists | |
taxonomy_exists( $taxonomy ) | |
// An Author Page // Cuando se muestra una página de autor | |
is_author() | |
is_author( '4' ) | |
is_author( 'Vivian' ) | |
is_author( 'john-jones' ) | |
is_author( array( 4, 'john-jones', 'Vivian' ) ) | |
// A Multi-author Site | |
is_multi_author( ) | |
// A Date Page | |
is_date() | |
is_year() | |
is_month() | |
is_day() | |
is_time() | |
is_new_day() | |
// Any Archive Page | |
is_archive() | |
// A Search Result Page | |
is_search() | |
// 404 | |
is_404() | |
// A Paged Page | |
is_paged() | |
// An Attachment | |
is_attachment() | |
// Attachment Is Image | |
wp_attachment_is_image( $post_id ) | |
// Post Type Exists | |
post_type_exists( $post_type ) | |
// Is Main Query | |
is_main_query() | |
// A Preview | |
is_preview() | |
// Has An Excerpt | |
has_excerpt() | |
// Has A Nav Menu Assigned | |
has_nav_menu() | |
// Inside The Loop | |
in_the_loop() | |
// Is Dynamic SideBar | |
is_dynamic_sidebar() | |
// Is Sidebar Active | |
is_active_sidebar() | |
// Is Widget Active | |
is_active_widget( $widget_callback, $widget_id ) | |
// Is Blog Installed | |
is_blog_installed() | |
// Is User Logged in | |
is_user_logged_in() | |
// Email Exists | |
email_exists( $email ) | |
//Username Exists | |
username_exists( $username ) | |
// An Active Plugin | |
is_plugin_active( $path ) | |
is_plugin_active( 'akismet/akismet.php' ) | |
is_plugin_inactive( $path ) | |
is_plugin_active_for_network( $path ) | |
is_plugin_page() | |
// A Child Theme | |
is_child_theme() | |
// Theme supports a feature | |
current_theme_supports() | |
current_theme_support( 'post-thumbnails' ) | |
// Has Post Thumbnail | |
has_post_thumbnail( $post_id ) | |
//Script Is In use | |
wp_script_is( $handle, $list ) | |
// Is Previewed in the Customizer | |
is_customize_preview() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment