Title: custom loop help
Last modified: August 19, 2016

---

# custom loop help

 *  [raptrex](https://wordpress.org/support/users/raptrex/)
 * (@raptrex)
 * [18 years, 3 months ago](https://wordpress.org/support/topic/custom-loop-help/)
 * for my custom loop, the posts are in categories with the first post being an 
   excerpt and the previous 5 posts of that category is just the title of that post
   
   ex:
 * Cat (category)
    Latest post 6 in Cat bla bla bla bla Previous post 5 in Cat Previous
   post 4 in Cat Previous post 3 in Cat Previous post 2 in Cat Previous post 1 in
   Cat
 * Dog (category)
    Latest post 6 in Dog bla bla alblabl lal Previous post 5 in Dog…
 * so how would i do this?

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Thread Starter [raptrex](https://wordpress.org/support/users/raptrex/)
 * (@raptrex)
 * [18 years, 3 months ago](https://wordpress.org/support/topic/custom-loop-help/#post-673437)
 * ok i dont think you can make it do each category in sections automatically so
   i think i have to do it like this:
    <?php $posts = get_posts( “category=3&numberposts
   =3” ); ?>
 * but how would i make it where the latest post in that category is an excerpt 
   then the rest in that cat is a list
 * then do it again for the rest of the categories
 *  Thread Starter [raptrex](https://wordpress.org/support/users/raptrex/)
 * (@raptrex)
 * [18 years, 3 months ago](https://wordpress.org/support/topic/custom-loop-help/#post-673468)
 * `<?php $posts = get_posts( "category=2&numberposts=3" ); ?>
    <?php if( $posts):?
   >
 * <div class="post" id="modernScience">
    <h2>Modern Science</h2> <?php foreach(
   $posts as $post ) : setup_postdata( $post ); ?> <div class="pleft"> <h3 class
   ="entry-title">" title="<?php printf(__('Permalink to %s'), wp_specialchars(get_the_title(),
   1)) ?>" rel="bookmark"><?php the_title() ?></h3> <div class="entry-content"> 
   <?php the_content("<span class=\"continue\">" . __('Continue reading','') . "'".
   the_title('', '', false) . "'</span>"); ?> </div> </div> <div class="pright">
    - 
 *  </div>
    <?php endforeach; ?>
 * </div>
 * <?php endif; ?>
 * <?php $posts = get_posts( "category=3&numberposts=3" ); ?>
    <?php if( $posts ):?
   >
 * <div class="post" id="lifestyle">
    <h2>Lifestyle</h2>
    -  <?php foreach( $posts as $post ) : setup_postdata( $post ); ?>
       <div class
      ="pleft"> <h3 class="entry-title">" title="<?php printf(__('Permalink to %
      s'), wp_specialchars(get_the_title(), 1)) ?>" rel="bookmark"><?php the_title()?
      ></h3> <div class="entry-content"> <?php the_content("<span class=\"continue\"
      >" . __('Continue reading','') . " '" . the_title('', '', false) . "'</span
      >"); ?> </div> </div> <div class="pright">
 *  - 
 *  </div>
    <?php endforeach; ?>
 * </div>
 * <?php endif; ?>
 * so this is what i have so far
    but how do i make the latest post be in “pleft”
   and the next 5 in “pright”?

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘custom loop help’ is closed to new replies.

 * In: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
 * 2 replies
 * 1 participant
 * Last reply from: [raptrex](https://wordpress.org/support/users/raptrex/)
 * Last activity: [18 years, 3 months ago](https://wordpress.org/support/topic/custom-loop-help/#post-673468)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
