Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Updated to fix / add functionality described with taxonomy conditions -

  • Loading branch information...
commit d008fead176bb57eb958ca79ee33b75d46e21637 1 parent f4bfb11
Ross Morsali authored
Showing with 19 additions and 4 deletions.
  1. +19 −4 classes/class-woo-conditions.php
23 classes/class-woo-conditions.php
View
@@ -278,10 +278,11 @@ public function setup_default_conditions_reference () {
if ( count( $terms ) > 0 ) {
$conditions['taxonomy-' . $k] = array();
foreach ( $terms as $i => $j ) {
+
$conditions['taxonomy-' . $k]['term-' . $j->term_id] = array( 'label' => esc_html( $j->name ), 'description' => sprintf( __( 'The %s %s archive', 'woosidebars' ), esc_html( $j->name ), strtolower( $taxonomy->labels->name ) ) );
- if ( $k == 'category' ) {
- $conditions['taxonomy-' . $k]['in-term-' . $j->term_id] = array( 'label' => sprintf( __( 'All posts in "%s"', 'woosidebars' ), esc_html( $j->name ) ), 'description' => sprintf( __( 'All posts in the %s %s archive', 'woosidebars' ), esc_html( $j->name ), strtolower( $taxonomy->labels->name ) ) );
- }
+
+ $conditions['taxonomy-' . $k]['in-term-' . $j->term_id] = array( 'label' => sprintf( __( 'All posts in "%s"', 'woosidebars' ), esc_html( $j->name ) ), 'description' => sprintf( __( 'All posts in the %s %s archive', 'woosidebars' ), esc_html( $j->name ), strtolower( $taxonomy->labels->name ) ) );
+
}
}
@@ -381,10 +382,24 @@ function is_hierarchy () {
if ( ! is_wp_error( $categories ) && ( count( $categories ) > 0 ) ) {
foreach ( $categories as $k => $v ) {
+
$this->conditions[] = 'in-term-' . $v->term_id;
}
}
-
+
+ global $post;
+
+ $post_taxonomies = get_post_taxonomies(get_the_ID());
+
+ foreach($post_taxonomies as $post_taxonomy)
+ {
+ $term_list = wp_get_post_terms(get_the_ID(), $post_taxonomy, array("fields" => "ids"));
+ foreach($term_list as $term)
+ {
+ $this->conditions[] = 'in-term-'.$term;
+ }
+ }
+
$this->conditions[] = 'post' . '-' . get_the_ID();
}
Please sign in to comment.
Something went wrong with that request. Please try again.