Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php $cats = get_categories('orderby=count&order=DESC');
- foreach ($cats as $cat) :
- echo '<div class="col">';
- $args = array(
- 'posts_per_page' => -1, // max number of post per category
- 'cat' => $cat->term_id
- );
- query_posts($args);
- if (have_posts()) :
- $num_of_posts = $wp_query->post_count;
- echo '<h2>Latest '; if($num_of_posts>1) { echo $num_of_posts; }; echo ' Post'; if($num_of_posts>1) { echo 's';} ; echo ' in '.$cat->name.' Category</h2>';
- while (have_posts()) : the_post(); ?>
- <div <?php post_class() ?> id="post-<?php the_ID(); echo ' '.$marker; ?>">
- <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
- <small><?php the_time('F jS, Y') ?> by <?php the_author(); ?> </small>
- <div class="entry">
- <?php the_excerpt(); ?>
- </div>
- <p class="postmetadata">Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?> <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?><br /><?php the_tags('keywords: ', ', ', ' '); ?> </p>
- </div>
- <?php endwhile; ?>
- <?php else :
- echo '<h2>No Posts for '.$cat->name.' Category</h2>';
- endif;
- wp_reset_query(); ?>
- <?php
- echo '</div> <!--end of col-->';
- endforeach; ?>
Advertisement
Add Comment
Please, Sign In to add comment