Skip Navigation

[Resolved] Trying to add a filter populated by parent taxonomy terms

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 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 13 replies, has 3 voices.

Last updated by Luo Yang 1 year, 11 months ago.

Assisted by: Luo Yang.

Author
Posts
#2488131

Tell us what you are trying to do? I have a view showing television channels. Each post is related to a parent Station post and those have a taxonomy. I display all channels assigned along with information from the related Station post.

I need to provide a dropdown allowing users to select from a list of station categories (Movie, news, kids, etc.). I'm planning on doing this with a filter, but I don't know how to set it up.

Is there any documentation that you are following? Everything on this site.

Is there a similar example that we can see? n/a

What is the link to your site? hidden link

#2488549

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi there

Your View queries and iterates over channels, and also outputs data from the parent station.

You want to add a category filter.

But the categories are assigned to the stations, not to the channels? So you might have a movie station, and all of its channels are implicitly movie channels?

So the filter would be to show all channels of any movie stations, is that the idea?

If you are struggling to do it that would be because you cannot filter one thing (channels) by a property of something else (stations).

It seems like you would need to assign a taxonomy to channels if you want to filter channels by that taxonomy.

#2488873

This is for cable TV boxes. Stations are ABC, CNN, Weather Channel, etc. One station can be assigned to many channels. One for standard definition, and another for high definition. In different parts of the state, the numbers assigned to a station can be different.

My view displays channels for each area. Stations (the one side of the one-to-many relationship to channels) have categories; kids, news, sports, etc. I already show the category of the parent station in each row of my channel view.

I need a way to filter my view by the Station categories. I need to provide a dropdown or radio buttons where the options are the unique Station categories. I could make a taxonomy view for Station categories but, can I insert that view into the filter section of the Channel view and expect that to function?

#2489217

Hello,

I assume we are talking about two post types:
- Stations( with taxonomy categories)
- Channel
One-to-many relationship between Stations and Channel

It needs a nested views, for example:
1) Parent post view:
- Query Stations posts
- Filter by taxonomy categories
- In view's loop, display below child post view
2) Child post view:
- Query Channel posts
- Filter by post type relationship between Stations and Channel
- In view's loop, display Channel information

#2489843

What I thought & I will give it a try. Thanks for the response - saves me lots of time!

It makes sense that the parent would be Stations & that everything I need to do depends on nesting a channel view inside stations.

The only reason I didn't do this is because I need to show or hide channels based on 4 other conditions. I now realize that those conditions are not a complexity of cencern for Toolset and that, the bigger concern is understanding the primary search post type.

Brilliant! Thank-you.

#2490365

Just thinking about this - if the parent view - Stations calls a child view - Channels, can I still sort the parent view by the station channel number? Ultimately, I need to display the channels from #1 up. Can that parent, Station view provide sorting by the title of the child posts?

#2490911

No, Toolset Blocks/Views plugin is using WordPress built-in class WP_Query to query posts, you can only sort the result by fields of same post type, you can not sort the result by fields of other post types.

So you can not sort the parent Stations post view by fields of another post type "Channel".

#2493105

I have 3 post types: Products, Cases and Items.

A Product is a case filled with a quantity of items. I need to display products but allow users to filter by Item fields. The particular fields I'm using for filtering are relatively short strings.

I realize that I cannot filter on fields and taxonomies of my view's post type. But, wouldn't it be possible to make a taxonomy on the main post type who's terms simply stayed synchronized with the title field of the related posts? If each item has a field called 'Item Variety', I would add a taxonomy to Products called Item Variety. It's terms would be all of the unique strings among the Item Variety field and each product would have the taxonomy that matches the Item Variety field.

I could manually generate the list of unique terms from the Item Variety field and manually create a taxonomy for products with those terms. I could then create a view that would set the taxonomy of each product to match the values in the Item Variety field for all the items in that product. I would then be able to filter products based on that taxonomy.

It seems like there should be a relatively easy way to instruct Toolset to take a field from a post type and generate unique taxonomy terms that it would assign to another post type. This may already be possible using Toolset Relationships, but I don't know.

New threads created by Luo Yang and linked to this one are listed below:

https://toolset.com/forums/topic/synchronized-with-the-title-field-of-the-related-posts/

#2493121

Looking into this further, I already have 2 Toolset taxonomies created for Items: Item Variety and Item Packaging. I can assign both of those taxonomies to both Items and Products.

Then, when I add Items to a Product, I need to select the same Variety and Packaging for both the product and the items in the product. Then my product view would be able to filter on Variety and Packaging - essentially do a parametric search.

I already have a relationship between Products and Items. Isn't there a way to automatically set the taxonomy for the Product to match each time I connect a product to an item?

#2493273

According to our support policy, we prefer one ticket one question, I assume the original questions of this thread is resolved, for other new issues, please check the new ticket here:
https://toolset.com/forums/topic/synchronized-with-the-title-field-of-the-related-posts/

#2493847

Sorry about that - I've closed the other ticket.

#2494127

OK, please update here if you still assistance for the original issue.

#2496823

There must be a way of attaching a post type as a taxonomy of another post type. If I have a post type of Products and another post type, Boxes that I put my Products in, I can certainly create a relationship and attach Products to Boxes. But, if I'm viewing Products, it would be great to be able to filter those Products by custom fields created for the Boxes they are related to.

Currently, the WP Query code prevents users from filtering terms and fields from a related product in a view. But, if I could maintain a taxonomy for Products with terms that automatically stay synchronized with Box posts, then I have a Product taxonomy, also called Boxes that would provide the connection to the related field. The entire taxonomy could be hidden and managed automatically as related posts are edited.

Perhaps there could be a feature added to Toolset offering the option of these related taxonomies, along with the choice of which fields should be used for the terms of the taxonomy. Title would be the default, but it should allow selection of any fields and, for each field selected, an additional taxonomy would be maintained. It wouldn't be necessary to provide a management interface for these types of taxonomies because their terms are automatically generated, edited and deleted with their corresponding posts.

This would provide a way to perform parametric filtering in Views.

#2497167

You can add a feature request for it:
https://toolset.com/home/contact-us/suggest-a-new-feature-for-toolset/
Our developers will evaluate it.