Answer the question
In order to leave comments, you need to log in
How to display internal headings and posts?
There is a heading in which other headings and posts are nested. Other posts are attached to child headings.
How to list internal categories and posts (without posts of child categories)
$term_id = 28; //Динамическая категория получаемая от открытой категории
$categories_sub = get_categories(array(
'child_of' => 0,
'parent' => $term_id,
'orderby' => 'name',
'order' => 'ASC',
'hide_empty' => 0,
'hierarchical' => 1,
'number' => 0,
'taxonomy' => 'category',
'pad_counts' => false
));
$posts_sub = get_posts(array(
'offset' => 0,
'category' => $term_id,
'orderby' => 'post_date',
'order' => 'DESC',
'meta_value' => '',
'post_type' => 'post',
'post_status' => 'publish'
));
$data_list = array_merge($categories_sub, $posts_sub);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question