Skip Navigation

[Resolved] Excluding echoing a category name in wpv-post-taxonomy

This support ticket is created 3 years, 10 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: Africa/Casablanca (GMT+01:00)

This topic contains 8 replies, has 2 voices.

Last updated by michaelS-53 3 years, 10 months ago.

Assisted by: Jamal.

Author
Posts
#1669413

We're rendering out a number of category names, but I want to exclude showing certain terms (even if I'm including the actual category type).

For example, I want to show posts that fall under both "News" and "Highlights", but I only want to render out the "News" category as text. I'd like to exclude the "Highlight" category. Is there a way to do this?

Thanks!

#1669927

I received a strange message telling me I had to reinstall Types, but the plugin is working fine? I also now can't find the message.

#1669929

Jamal
Supporter

Languages: English (English ) French (Français )

Timezone: Africa/Casablanca (GMT+01:00)

Hello and thank you for contacting the Toolset support.

You can use conditional output to render the post only if it has the correct category, check this article https://toolset.com/documentation/user-guides/views/conditional-html-output-in-views/

To better assist you with this issue, I'll need to take a closer look at your view. Your next reply will be private to let you share credentials safely. ** Make a database backup before sharing credentials. **

#1671077

Hi Jamal,

I may not have explained my problem well. I just need to hide the category name on the frontend, not remove the category from the post. Ergo, if something is a "Highlight" AND a "Podcast" in its categories, I only want to show Podcast and omit Highlight. Is there a way to make that happen?

#1672051

Jamal
Supporter

Languages: English (English ) French (Français )

Timezone: Africa/Casablanca (GMT+01:00)

This can be done using conditional shortcodes or blocks depending on whether you are building your views with the legacy views editor or with the new block editor.
Conditions can be nested and combined to get what you exactly want, check the following articles, if you still need assistance with this issue, please allow me temporary access to your website to check your use case closely.
- https://toolset.com/documentation/user-guides/views/conditional-html-output-in-views/
- https://toolset.com/documentation/user-guides/views/conditional-html-output-in-views/nesting-and-combining-conditions/
- https://toolset.com/documentation/user-guides/views/conditional-html-output-in-views/using-shortcodes-in-conditions/
- https://toolset.com/documentation/user-guides/views/conditional-html-output-in-views/using-custom-functions-in-conditions/

** Make a database backup before sharing credentials. **

#1672913

All right, so I *kind* of got this working by embedding a view within a view.

hidden link If you look at the hero image and the thumbnails in the row immediately beneath it, I've managed to have it pull the category tags for articles such as "Podcast" and "News", while omitting others.

I did this by creating a view for Taxonomy that only lists the terms I want. I then embedded it in another view that makes it list for Article posts only. Buuuut now the issue is that it just lists *all* the categories, not the ones selected for a specific post. For example, both the articles for SINoALICE and Shark RPG Maneater list the same categories (I've set the limit to 3), even though they have different lists.

Can I get some help figuring this step out? Thanks.

#1672927

My issue is resolved now. Thank you!

#1672949

Hi Jamal,

So although I got most of what I wanted working, there is a problem I'm not sure how to resolve.

If you look at the front page here: hidden link

Posts are omitting "highlight" properly, BUT if a post is both a) not a highlight and b) a post, it displays nothing. I have no idea why. It's only set up to omit the highlight term, not all the terms, and on posts that are highlights, it omits the terms and displays the others like it's supposed to.

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

https://toolset.com/forums/topic/excluding-echoing-a-category-name-in-wpv-post-taxonomy-2/

#1672971

So as it turns out, I had to add a filter to show all categories. I'm not sure why, but it restored showing the categories while still omitting the highlights printout.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.