The situation is this: there are categories
Каталог - Уровень 2 -- Уровень 3 --- Запись How to write a condition for category.php correctly to display different code at each category level?
The situation is this: there are categories
Каталог - Уровень 2 -- Уровень 3 --- Запись How to write a condition for category.php correctly to display different code at each category level?
$current_cat_id = get_query_var('cat'); $child = get_category($current_cat_id); $level2 = $child->parent; $child2 = get_category($level2); $level3 = $child2->parent; if(is_category(6)){ include "catalog.php"; } else if ($level2 == 6){ include "catalog_level2.php"; } else if ($level3 == 6){ include "catalog_level3.php"; } Source: https://ru.stackoverflow.com/questions/524590/
All Articles