Support » Fixing WordPress » Displaying the_content in a foreach loop

  • Resolved lynkei

    (@lynkei)


    Hello,
    I am using the following code to display all posts on a page. My issue is that the <?php the_content(); ?> does not seem to display the content of each post. Can anyone point out what I’m doing wrong?
    Thanks

    <?php
    $new = "
         SELECT *
         FROM $wpdb->posts
         WHERE post_type = 'post'
    	 AND post_status = 'publish'
         ORDER BY ID ASC
    ";
    
    $query_result = $wpdb->get_results($new, OBJECT);
    ?>
    <?php if ($new): ?>
         <?php foreach ($query_result as $post): ?>
         <?php static $count2 = 0; ?>
         <div class="bauhaus size36px colororange"><?php the_title(); ?></div><br />
         <div class="size12px">
         <?php the_content(); ?>
    <?php endforeach; ?>
    <?php endif; ?>
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Displaying the_content in a foreach loop’ is closed to new replies.