Title: Loop Inside Loop &#8211; getting noch postdata
Last modified: August 19, 2016

---

# Loop Inside Loop – getting noch postdata

 *  [nightstalker101](https://wordpress.org/support/users/nightstalker101/)
 * (@nightstalker101)
 * [15 years, 10 months ago](https://wordpress.org/support/topic/loop-inside-loop-getting-noch-postdata/)
 * Hi,
 * I habe a Loop inside a Loop, but do not get all postdata. All I get is the ID.
   The Title and so on are not shown. Why? This is my code:
 *     ```
       <?php the_content(); ?>
                               <?php wp_reset_query(); ?>
                               <?php if (is_page('Themen')):
                               global $wp_query;
       						global $wpdb;
       						$query = "SELECT ID
       									FROM wp_posts
       									WHERE
       									post_type = 'page'
       									AND post_status = 'publish'
       									AND post_parent = 986
       									";
                               global $post;
       						$posts = $wpdb->get_results($query);
       						var_dump($posts);
       						echo '<ul>';
       						foreach($posts as $post) :
       						setup_postdata($post);
       						?>
       							<li><?php echo the_ID(); ?><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
                                </li>
       						 <?php endforeach; ?>
       ```
   
 * Lars

The topic ‘Loop Inside Loop – getting noch postdata’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 0 replies
 * 1 participant
 * Last reply from: [nightstalker101](https://wordpress.org/support/users/nightstalker101/)
 * Last activity: [15 years, 10 months ago](https://wordpress.org/support/topic/loop-inside-loop-getting-noch-postdata/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
