E
E
Evgeniy2020-08-03 12:27:10
WordPress
Evgeniy, 2020-08-03 12:27:10

How to display all posts of all categories on a common page, and display only your own posts in child categories?

Hello everyone, please help to solve the problem of displaying posts All

categories with posts are displayed by the archive.php template
At site.ru/category/rubrika-all


if($_SERVER['SCRIPT_URL'] = '/category/rubrika-all') {
    $h1Tag = 'Все посты';
    query_posts('cat=97&posts_per_page=50');
}


The problem is that now ALL posts are displayed in EVERY category whose url starts with /category/rubrika-all/ Type: /category/ rubrika
-all/rubrika-one So that at the same time, child categories display only their own posts Is it possible to: Specify the exact url so that it ends with a slash and this rule does not apply anywhere else?


$_SERVER['SCRIPT_URL']

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Lopatin, 2020-08-03
@ClipClock08

https://wp-kama.ru/function/wp_query
and take the id of the term on or slug and insert it into tax_query

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question