New answers tagged

2

Extend the Walker_Category class We can extend the Walker_Category class to append the category description to each item. Here's a demo example with an anonymous class (PHP 7+): $args = [ 'walker' => new class extends Walker_Category { public function start_el( &$output, $category, $depth = 0, $args = array(), $id = 0 ) { ...


1

Do the categories all have posts, change line 2 to: $categories = wp_list_categories('hide_empty=0&title_li=0&child_of='.$categoryslug->term_id'); This sets it to display all categories even if empty If that doesn't work then you need to echo each part and find the cause of the "error" so echo each element e.g. echo $categoryslug; if that ...


0

$categories = get_categories( array( 'child_of' => 10 ); foreach ( $categories as $category ) { $args = array( 'posts_per_page' => 5, 'offset' => 0, 'category' => category , 'category_name' => '', 'orderby' => 'date', 'order' => 'DESC', ...



Top 50 recent answers are included