• I have a loop that displays the recent posts for a custom post type, grouped by a custom taxonomy.

    <?php
    	$categories = get_terms('section', 'orderby=count&order=DESC&hide_empty=1&exclude=60,59');
    	 foreach( $categories as $category ):
    	 ?>
    	 <h3><?php echo $category->name; // Prints the cat/taxonomy group title ?></h3>
    	 <?php
    	 $posts = get_posts(array(
    	 'post_type' => 'knowledgebase',
    	 'taxonomy' => $category->taxonomy,
    	 'term' => $category->slug,
    	 'nopaging' => true,
    	 ));
    	 foreach($posts as $post):
    	 setup_postdata($post); //enables the_title(), the_content(), etc. without specifying a post ID
    	 ?>
    	 <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    
    	 <div class="entry-content">
    	 <?php the_title();?>
    	 </div><!-- .entry-content -->
    
    	 </div><!-- #post-## -->
    	 <?php endforeach; ?>
    
    	<?php endforeach; ?>

    But how do I now take this and style the first of each post from each custom taxonomy differently? i.e. I want to show the excerpt of the first post, and just the titles of the rest…

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Styling first post differently in this particular loop’ is closed to new replies.