Skip Navigation

[Resolved] Global View with Separate Query

This support ticket is created 4 years, 11 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)

This topic contains 4 replies, has 2 voices.

Last updated by charlesS-11 4 years, 11 months ago.

Assisted by: Christian Cox.

Author
Posts
#1711909

Tell us what you are trying to do?
I have a lot of pages that will need a View on the page. All the Views will be identical in style, but will query the database with different terms. Is there a way to create a global view that will allow me to add different query terms once placed on the page without updated the query for all the other pages using the same View?

Is there any documentation that you are following?
I couldn't find anything pertaining to this.

Is there a similar example that we can see?
No

What is the link to your site?
Still in development

#1711991
Screen Shot 2020-07-19 at 5.24.48 PM.png

Hi, you can create a dynamic Query Filter for taxonomy terms, set by the Page where the View is shown. In the Block Editor, use the Block Navigation menu to select the top-level View block. Then in the right column, you'll see the Query Filter panel. Create a taxonomy Query Filter, and you will have the option to filter by the terms applied to the post or page where the View is shown. So let's say for example you want to filter a View by a custom taxonomy "Color", and you want to show that View on all Pages, but you only want to show results related to the current Page's color terms. Add the View in the Content Template applied to all Pages. Edit the Color taxonomy and activate it for the Pages post type, so you can set Color terms for each Page. Now if you apply the terms "red" and "orange" to Page 1, the View will display results filtered by the terms "red" and "orange" from the Color taxonomy on Page 1. Apply the terms "blue" and "green" to Page 2, and the same View will display results filtered by the terms "blue" and "green" on Page 2. Apply no terms to Page 3, and the View will display unfiltered results on Page 3. See the screenshot here for an example of this type of dynamic Query Filter.

Let me know if I misunderstood what you want to accomplish, and I can give you some feedback.

#1712049

Thanks Christian. I understand how to create a taxonomy filter. Maybe this will help explain.

Steps to recreate my question:

1. Add a View to the page---- , create new block->select container->select View
2. Two(2) choices--one to create a new view and one to use an existing one. I want to use an existing one because it's already designed the way I like.
3. I choose an existing View
4. Two(2) new choices--Edit Original View or Edit Copy

I don't want to 'Edit Copy' because it just creates a new copy and I end up with a ton of views in my system, plus if I want to edit the view later, I need to open every view individually to make edits. If I 'edit Original View' and then adjust the taxonomy filter, it adjusts for all views.

Does this make any sense? 🙂 Thank. you for your help.

#1712775

I want to use an existing one because it's already designed the way I like.
In this case, it's best to create copies of the same View and edit those copies. If you want, you could create a reusable block from the block editor design, so it only needs to be edited in one central location, but you could apply different Query Filters in the View copies. There is not an easy way to reuse a single View with completely different Query Filters like you have described. You can configure the Query Filter to respond to the place where the View is shown, or you must create a separate View with a separate Query Filter.

#1712843

My issue is resolved now. Thank you!