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