Skip Navigation

[Resolved] Display posts of a certain category item

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 – 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/Karachi (GMT+05:00)

This topic contains 2 replies, has 2 voices.

Last updated by polyviosE 3 years, 4 months ago.

Assisted by: Waqar.

Author
Posts
#2349923

Tell us what you are trying to do?

I have created a custom post and a custom taxonomy (custom post category) which in turn has 4 category items. I want to display posts that belong only to one out of the four of category items. I have been using views and conditional blocks. I created four checkbox custom field, one for each category items, and assigned to that custom post type. I have used a conditional display rule for only the posts with the selected category item checked to be shown. However, the output delivers all the posts of that taxonomy (ie everything that is assigned to any of the four category items).

Is there a way to dynamically display specific posts that belong to one category item only? Can you please clarify the steps for doing so?

Is there any documentation that you are following?

https://toolset.com/2021/08/5-advanced-uses-of-toolsets-conditional-block-in-wordpress/

#2350287
taxonomy-query-filter-example.png

Hi,

Thank you for contacting us and I'd be happy to assist.

For this kind of filtering, you don't have to use the conditional block.

As shown in the attached screenshot, you can include a taxonomy filter in the view's query filter settings, so that the target term's slug can be passed in the view's shortcode attribute.

After that, you'll be able to use the same view to show posts from different taxonomy terms, by just changing the shortcode attribute value.

For example, to show the results associated with the term with slug "term-1-slug", the shortcode of the view would be:
( ref: https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#wpv-view )


[wpv-view name="view-name" wpvcategory="term-1-slug"]

Likewise, to show the results from the term with slug "term-2-slug", the shortcode would become:


[wpv-view name="view-name" wpvcategory="term-2-slug"]

I hope this helps and please let me know if you need any further assistance around this.

regards,
Waqar

#2351179

My issue is resolved now. Thank you!