How to display post categories in hierarchical order and posts lists
-
Hello,
I have a big issue with WordPress.
I would like to make a “support” blog website, with articles classified in different categories.
For a better assistance and easy navigation, I would like to propose 3 hierarchical levels of post categories (0,1 and 2)
In the deepest category (level 2), I would like to display posts wich belong to this last category.
For example :
– Homepage of my blog : “Choose your category” (List categories level 0)
– When I click on a “level 0” link, I access to the archive page (archive.php).In this archive page with 2 columns, I would like to display on the right column :
CHOOSE A “LEVEL 0” CATEGORY :
Category level 1 (+ More)
—Category level 2 (+ More)
——— > Post 1
——— > Post 2
——— > Post 3I tried with :
1) <?php wp_list_categories( $args ); ?> (hierarchical order, but no posts)
2) $categories = get_categories($cat_args);
foreach($categories as $category)
$args=array(‘showposts’ => -1,’category__in’ => array($category->term_id), ‘caller_get_posts’=>1);
$posts=get_posts($args);
…
The posts are displayed, but categories are not in hierarchical order.Could you help me to find a solution please ?
This is an example of a support blog found on internet (French website)
:
https://www.assistance.bouyguestelecom.fr/Thank you so much !
- The topic ‘How to display post categories in hierarchical order and posts lists’ is closed to new replies.