J
J
Jimmy Neutron2018-07-18 21:25:02
WordPress
Jimmy Neutron, 2018-07-18 21:25:02

What is the right way to infer taxonomy?

Guys, everything seems to be simple, but I'm already confused, so I'm writing here. Maybe you can help unravel this.
I made a separate Post_type on the site, for example "Pizza", I attached a taxonomy (categories) to it.
So, what was the problem and where did you get confused:
All pizzas are divided into open and closed ones. In each category there are 1 - 3 subcategories, but there are also pizzas that do not belong to these subcategories.
On the page with all pizzas, you need to display a list of pizzas, i.e. a link to the pizza itself, but if pizza belongs to a subcategory (for example, vegan), then a link should be displayed not to the pizza itself, but to the "vegan" category, and a list of vegan pizzas should already be displayed there.
So, how can I get this out, I already dug into the network, tried in different ways, maybe I was nearby, but I missed something. Please, tell me)
========
I tried to describe in as much detail as possible so that they understand me)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Y
Yunus Gaziev, 2018-07-18
@BBoyJuss

You can display a list of categories and check the number of records (pizzas) in them, and if there is only one pizza in the category, then display a link to this pizza. Otherwise, leave the standard behavior with a link to the pizza category.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question