Skip Navigation

[Resolved] Category archive – filter custom fields

This thread is resolved. Here is a description of the problem and solution.

Problem: I have a WordPress Archive for a taxonomy, and in each item I have nested a View. In that View I would like to display information about the current item in the loop, but it always seems to output the same information for each item in the loop.

Solution: Add a post ID filter in the View, and set it to respond to a shortcode attribute. Pass the current post ID into the shortcode attribute like this:

[wpv-view name="nested-view-slug" ids="[wpv-post-id]"]

Relevant Documentation:
https://toolset.com/documentation/user-guides/passing-arguments-to-views/

This support ticket is created 5 years, 5 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
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

Tagged: 

This topic contains 4 replies, has 2 voices.

Last updated by hugoC-5 5 years, 5 months ago.

Assisted by: Christian Cox.

Author
Posts
#1349085
Schermafdruk 2019-09-26 14.12.30.png

Tell us what you are trying to do?
I have a category archive of events (menu item "Programma"), each item containing a view with start and end time and event type (custom fields). How can I filter this view so that each post displays the correct time and type? Now all posts display the same.

Is there any documentation that you are following?

Is there a similar example that we can see?

What is the link to your site?

#1349265

I think you should filter the nested View by post ID, set by a shortcode attribute "ids". Pass the current post's ID into that shortcode attribute, like this:

[wpv-view name="nested-view-slug" ids="[wpv-post-id]"]

This will force the nested View to display information about the current post in the loop.

#1349483
Schermafbeelding 2019-09-26 om 19.47.24.png

I tried to add the post id's into the shortcode inside my content template but this didn't work; I am still getting only one (wrong) result instead of the correct time and type for each post. Am I doing something wrong?

#1349503
Screen Shot 2019-09-26 at 2.13.54 PM.png

You must also add the corresponding Post ID query filter to the sessie-grid-box View. See the screenshot here.

#1349765

My issue is resolved now, thanks a lot. You made my day!