ControlledChaos of Controlled Chaos Design
8/9/2016 - 6:42 PM

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