Warning: Array to string conversion in /mnt/data/home/502433.cloudwaysapps.com/rhbymdevka/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 808
Warning: foreach() argument must be of type array|object, string given in /mnt/data/home/502433.cloudwaysapps.com/rhbymdevka/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 813
Warning: Array to string conversion in /mnt/data/home/502433.cloudwaysapps.com/rhbymdevka/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 808
PUM_ConditionCallbacks::taxonomy( array $condition = array() )
Checks if this is one of the selected taxonomy term.
Description Description
Warning: Array to string conversion in /mnt/data/home/502433.cloudwaysapps.com/rhbymdevka/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 808
Warning: foreach() argument must be of type array|object, string given in /mnt/data/home/502433.cloudwaysapps.com/rhbymdevka/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 813
Warning: Array to string conversion in /mnt/data/home/502433.cloudwaysapps.com/rhbymdevka/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 808
Parameters Parameters
- $condition
-
(Optional)
Default value: array()
Return Return
(bool)
Source Source
File: classes/ConditionCallbacks.php
public static function taxonomy( $condition = array() ) { $target = explode( '_', $condition['target'] ); // Remove the tax_ prefix. array_shift( $target ); // Assign the last key as the modifier _all, _selected $modifier = array_pop( $target ); // Whatever is left is the taxonomy. $taxonomy = implode( '_', $target ); if ( $taxonomy == 'category' ) { return self::category( $condition ); } elseif ( $taxonomy == 'post_tag' ) { return self::post_tag( $condition ); } switch ( $modifier ) { case 'all': if ( is_tax( $taxonomy ) ) { return true; } break; case 'ID': case 'selected': $selected = ! empty( $condition['settings']['selected'] ) ? $condition['settings']['selected'] : array(); if ( is_tax( $taxonomy, wp_parse_id_list( $selected ) ) ) { return true; } break; } return false; }
Expand full source code Collapse full source code View on Trac