M
M
MeloD2017-01-20 05:29:05
WordPress
MeloD, 2017-01-20 05:29:05

How to display a different number of products in different categories?

Hello.
The task is such that it is necessary that 9 products are displayed in the parent category, and all products in the child ones.
How can this be implemented? Maybe somehow you can take out the loop in the template?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ivan Kozlov, 2017-01-20
@Slavich_Khe

You can change the number of products displayed on the page with the following line of code:
24 items will be displayed.
You just need to add a condition. This can be done in several ways:
-keep track of $_SERVER['REQUEST_URI'] and substitute the desired value instead of 24 for certain URLs.
- get the id of the current category. See if it has child categories, then display one value, if not, then another.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question