ControlledChaos
5/7/2015 - 9:30 AM

Category Loop

Category Loop

<?php

  $cats = get_categories(); 

  foreach ( $cats as $cat ) {
    
    $cat_id= $cat->term_id;
    
    echo '<h2>' . $cat->name . '</h2>';
    query_posts( 'cat=$cat_id&posts_per_page=100' );
    
    if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
      <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
      <hr/>

    <?php endwhile; endif;
  }
  
?>

Category Loop

WordPress Snippet