I'm creating a single page site and obviously want to include the blog posts. I'm currently looping through the pages and using the_content() and the_title() to display them. However, the_content doesn't include the blog posts on the blog page. I tried another loop in this one, but it didn't work. Any ideas to point me in the right direction? Thanks


To include posts and pages in the loop, use the 'post_type' argument:

$wp_query = new WP_Query();
$args = array(
     'post_type' => array('post','page')
while ($wp_query->have_posts()) : $wp_query->the_post();

<?php the_content(); ?>

<?php endwhile; ?>


| improve this answer | |
  • Ah didn't think to use post_type, thanks a bunch. I can definitely use this help. Thanks! – ttt Jan 15 '12 at 12:36

From http://codex.wordpress.org/The_Loop_in_Action

if (have_posts()) :
  while (have_posts()) :

More info: http://codex.wordpress.org/The_Loop

If you want more help, post some code!

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.