Skip to content
This repository has been archived by the owner. It is now read-only.

Commit

Permalink
Fix for tags not working when grouping
Browse files Browse the repository at this point in the history
Previously, tags weren't working properly when breaking into groups
  • Loading branch information
szk11001 committed Nov 9, 2015
1 parent 2ccd55d commit a282f7b
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions uc-people-widget.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,20 +165,26 @@ public function widget( $args, $instance ){

if ( $settings['specific_groups'] != false || $settings['specific_tags'] != false ){
$tax_query = array();
$isGroupSet = false;
$isTagSet = false;

if ( $settings['specific_groups'] != false ) {
$tax_query[] = array(
$isGroupSet = true;
$taxGroupArray = array(
'taxonomy' => 'group',
'field' => 'term_id',
'terms' => $settings['specific_groups']
);
$tax_query[] = $taxGroupArray;
}
if ( $settings['specific_tags'] != false ) {
$tax_query[] = array(
$isTagSet = true;
$taxTagArray = array(
'taxonomy' => 'persontag',
'field' => 'term_id',
'terms' => $settings['specific_tags']
);
$tax_query[] = $taxTagArray;
}
$wpQueryArgs['tax_query'] = $tax_query;
}
Expand Down Expand Up @@ -220,6 +226,12 @@ public function widget( $args, $instance ){
'terms' => $value
);
array_push($tax_query, $group_query);
/*if( $isGroupSet != false ){
array_push($tax_query, $taxGroupArray);
}*/
if( $isTagSet != false ){
array_push($tax_query, $taxTagArray);
}
$wpQueryArgs['tax_query'] = $tax_query;

// with $arg updated, let's do a new query.
Expand Down

0 comments on commit a282f7b

Please sign in to comment.