How to show multiple pages on one page

code How to show multiple pages on one pageAs we know, query_posts is awesome. We are not only be able to retrieve posts but also pages by specifying its IDs on your theme templates. However if we want to multiple pages by using query_posts,the first thing we guess won’t work but here how to achieve it.

This is the first guess, right? But unfortunately, this doesn’t work…

<?php query_posts('page_id=5,9,10'); ?>

What you need to do instead is….

<?php
   $args = array('post_type' => 'page', 'post__in' => array(5,9,10));
   query_posts($args);
?>

I hope it helps someone who is looking for a solution.

Thanks to MichaelH for this code. Awesome!

Author: Takashi Irie

Takashi Irie is an experienced commercial web designer and Wordpress expert based in London. He is very passionate about web design, typography, grid systems as well as Wordpress.

Enjoyed this post? Share it!

  • Digg
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • LinkedIn
  • StumbleUpon
  • Twitter
  • email
  • RSS

Leave a Comment