Navigation überspringen

[Gelöst] Advanced filters not working

This support ticket is created vor 4 years. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Zeitzone des Unterstützers: Asia/Kolkata (GMT+05:30)

Dieses Thema enthält 3 Antworten, hat 2 Stimmen.

Zuletzt aktualisiert von Minesh vor 3 years, 12 months.

Assistiert von: Minesh.

Author
Artikel
#2379937

I am trying to: load a filtered view based on more than one attribute

Link to a page where the issue can be seen: versteckter Link

I expected to see: only posts matching the filter

Instead, I got: all posts even those not matching the filter

Please see this video https : // jumpshare . com /v/LmGrGbFmJymz2FCtHyA9 for information

#2380103

Minesh
Unterstützer

Sprachen: Englisch (English )

Zeitzone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

It seems you want to apply "AND" clause between the checkboxes option you select for "Topics" taxonomy.
=> versteckter Link

I've added the following filter code to "Custom Code" section offered by Toolset:

add_filter( 'wpv_filter_query', 'func_filter_by_taxonomy_terms_and_clause', 10, 3 );
function func_filter_by_taxonomy_terms_and_clause( $query, $view_settings, $views_id ) {
    if ( $views_id == 2019 ) {
       
      if(isset($_GET['wpv-post_tag']) and !empty($_GET['wpv-post_tag']) ){
        	$tax_array = array('relation'=>'AND');
            foreach($_GET['wpv-post_tag'] as $k=>$v):
        		$tax_query_array[] = array('taxonomy'=>'post_tag','field'=>'slug','terms'=>$v,'operator'=>'IN');
        	endforeach;
        	unset($query['tax_query']);
        	$query['tax_query'] = array($tax_query_array);
      }
     
         
    }
    return $query;
}

Could you please check now if it works as expected:
- versteckter Link

#2380493

Yes it is functioning like it should be now! Thanks!

But it looks like the layout on that view is now broken versteckter Link and overlapping the content box that it is inside of?

#2381309

Minesh
Unterstützer

Sprachen: Englisch (English )

Zeitzone: Asia/Kolkata (GMT+05:30)

I do not experience the same, I tried to filter the view with terms "Activism" and "HBCU" I can see it filters the result correctly.

Please check the following screenshot:
- versteckter Link

Do you still experience the issue?