Skip Navigation

[Resolved] Filter view by custom taxonomy twice

This support ticket is created 3 years, 4 months 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
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 3 replies, has 2 voices.

Last updated by poM 3 years, 4 months ago.

Assisted by: Shane.

Author
Posts
#2162263

poM

Tell us what you are trying to do?

I am trying to filter a nested view of custom post type A view which is already filtered by custom taxonomy B (defined by parent taxonomy view) a second time by custom taxonomy B (through URL parameter).

Hope it is clear enough 😉

Is there any documentation that you are following?

Is there a similar example that we can see?

What is the link to your site?

hidden link

#2162371

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hello,

Thank you for getting in touch. If I understand correctly you essentially want to filter the child view by a different taxonomy using the URL parameter correct?

#2162607

poM

Hi Shane,

Not exactly.

I am trying to filter the view by the same taxonomy twice.

This view is nested in a taxonomy view so I use the "defined by parent taxonomy view" criteria. I need to be able to group results by this taxonomy, this is why I proceed this way.

Second, I will need to search this view by this taxonomy using an exposed filters form.

Is there any way to achieve this ?

#2162847

poM

Hi,

I have finally manager to filter my taxonomy view by the URL parameter 'wpv-saison'.

Here is the working code below :

add_filter( 'wpv_filter_taxonomy_query', 'divi_filter_taxview_by_saison', 10, 3 );

function divi_filter_taxview_by_saison( $tax_query_settings, $view_settings, $view_id ) {

if($view_id == 51496 && isset($_GET['wpv-saison']) && $_GET['wpv-saison'] != '' ) {

$view_settings['slug'] = $_GET['wpv-saison'];
}
return $view_settings;
}