Post category provider / consumer not working

Hi there.

Please have a look at the blog page. You’ll see that the listing of category by post (on the blog page) lists all post categories (excluding the empty ones) where I would expect it to list only the categories of the particular (single) post.

I’ve set it up using “all terms” in the provider, then selecting "categories and excluding one category. The consumer. The reason for not using current post terms in the provider is that this configuration doesn’t give me the option to exclude a category.

What’s wrong? Thanks.

Hello @nblund,

Thanks for writing to us.

I checked your layout settings. It seems that you have displayed the category multiple times. When you list all the categories, you can set the Looper provider to All terms and exclude the empty categories.

Now, when you display the post category under the post, you need to set the Looper Provider as Current post terms, since it will only display those categories that are associated with the current posts. If the category is not attached to the post, it will not display.


Hope it helps
Thanks

Thanks @prakash_s. I want to hide the “all categories” category under the post, while maintaining all active post categories (including “all categories”) in the category menu on top of the posts.

When display the post category under the post while setting the Looper Provider as Current post terms, there is no option to hide the “all categories” category.

How can I achieve that? Thanks.

Hello @nblund,

I would suggest you please set the condition like this {{dc:term:id}} != 1. Please have a look at the given screenshot below.


I have added one as category ID since the “All categories” ID is 1.

Hope it helps
Thanks

Great, thanks.

You are most welcome, @nblund.

Hi again. I’ll continue this thread as the following may have to do with the above.

Please have a look at my blog page, specifically the article starting “Choosing between 5,000…” You’ll see that after the category name (Articles) a slash (/) appears despite this condition has been set: Index is not last. Why and how can I avoid it?

Thanks.

Thank you for the update. he condition “Index is not last” won’t work in this case if you’re trying to prevent displaying the forward slash after the last visible item. In the post "Choosing between 5,000…”, the first separator still renders because it’s associated with the first term “Article” — which technically is not the last item. The actual last item is the term “All”, but it’s hidden, along with its corresponding forward slash. You may need to enable Twig, move the Text element with the slash before the Text element with the term name, then use the following template to conditionally display the slash based on certain condition.

{% if looper.index_number !== 1 %}/{% endif %}

For more info about Twig templates, please check the link below:

https://theme.co/docs/twig

Thanks. Appreciated.

Hi @nblund,

You are most welcome.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.