Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix for tags not working when grouping
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
Expand Up @@ -165,20 +165,26 @@ Class UC_People_Widget extends WP_Widget {

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 @@ Class UC_People_Widget extends WP_Widget {
'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.