Styling first post differently in this particular loop (3 posts)

  1. Sarah_Frantz
    Posted 3 years ago #

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

    	$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>
    	 $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...

  2. Sarah_Frantz
    Posted 3 years ago #

    Ah, I think I solved this. nvm.

  3. kikimarie123
    Posted 2 years ago #

    Can you post the solution?

Topic Closed

This topic has been closed to new replies.

About this Topic