Saltar navegación

[Resuelto] Advanced filters not working

This support ticket is created 4 years ago. 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 -

Zona horaria del colaborador: Asia/Kolkata (GMT+05:30)

Este tema contiene 3 respuestas, tiene 2 mensajes.

Última actualización por Minesh 3 years, 12 months ago.

Asistido por: Minesh.

Autor
Mensajes
#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: enlace oculto

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
Colaborador

Idiomas: Inglés (English )

Zona horaria: 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.
=> enlace oculto

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:
- enlace oculto

#2380493

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

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

#2381309

Minesh
Colaborador

Idiomas: Inglés (English )

Zona horaria: 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:
- enlace oculto

Do you still experience the issue?