Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php $cats = get_categories('orderby=count&order=DESC');
- // http://codex.wordpress.org/Function_Reference/get_categories
- foreach ($cats as $cat) :
- echo $cat->name;
- $args = array(
- 'posts_per_page' => -1, // max number of post per category
- 'cat' => $cat->term_id
- );
- query_posts($args);
- if (have_posts()) :
- while (have_posts()) : the_post(); ?>
- <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a>
- <?php endwhile; ?>
- endif;
- wp_reset_query(); ?>
- <?php endforeach; ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement