$value) { $all_IDs[] = $categories[$key]->cat_ID; $post_count[]= $categories[$key]->count; } array_multisort($post_count, SORT_DESC, $categories); foreach ($categories as $key => $value): ?>
cat_ID; $post_count = $categories[$key]->count; $args = array('cat' => $cat_ID, 'posts_per_page' => 3,'ignore_sticky_posts' => false, ); $query = new WP_Query($args); //if (have_posts()): printf('

%2$s

', get_category_link($cat_ID), $categories[$key]->name); while ($query -> have_posts()): $query -> the_post(); if (get_the_title()): the_title(sprintf( '

', esc_url( get_permalink() ) ), '

' ); endif; endwhile; wp_reset_postdata(); //endif;?>