Title: Loop in a loop noob
Last modified: August 19, 2016

---

# Loop in a loop noob

 *  Resolved [rakemyleaves](https://wordpress.org/support/users/rakemyleaves/)
 * (@rakemyleaves)
 * [15 years, 7 months ago](https://wordpress.org/support/topic/loop-in-a-loop-noob/)
 * I created a custom post type called ‘profentia’. In this custom post type I created
   custom fields to hold data. I want each single ‘profentia’ post to display its
   data as well as the previous 4 post’s data. Currently, all posts display the 
   5 most recent days of data. How do I tell my new loop to start with the current
   post and go backwards? Let me know if more info is needed. Thanks in advance 
   🙂
 * This is the code I am using for my second loop:
 *     ```
       <?php
       $my_query = new WP_Query('post_type=profentia', 'showposts=5');
       if ( $my_query->have_posts() ) {
       while ( $my_query->have_posts() ) {
       $my_query->the_post();
       ?>
       <div class="inline-list-data"><?php the_meta(); ?></div><?php
       }
       }
       wp_reset_postdata();
       ?>
       ```
   

The topic ‘Loop in a loop noob’ is closed to new replies.

## Tags

 * [loop](https://wordpress.org/support/topic-tag/loop/)
 * [wp_query](https://wordpress.org/support/topic-tag/wp_query/)

 * In: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
 * 0 replies
 * 1 participant
 * Last reply from: [rakemyleaves](https://wordpress.org/support/users/rakemyleaves/)
 * Last activity: [15 years, 7 months ago](https://wordpress.org/support/topic/loop-in-a-loop-noob/)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
