WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] WP_Query with pages (5 posts)

  1. steadyedd
    Member
    Posted 5 years ago #

    HI. I'm building a site where we'd like to show a summary of 5 specific pages (not posts) on the home page. Sort of like a sub menu (there's a main nav menu at the page top as well created with wp_list_pages()). Normally I'd just use wp_list_pages() and include the required pages as a parameter. But...rather than just a list of links we'd like to show the Page Excerpt (using Peter Westwood's PJW Page Excerpt allowing me to add excerpts to a page) as well as a thumbnail added using a Custom Field. I've seen how to do this with posts or to pull the Custom Fields for the current page but not seen it like this for pages.
    Regards, Edward

  2. MichaelH
    Member
    Posted 5 years ago #

    The template tag, query_posts(), supports the argument post_type=page.

  3. steadyedd
    Member
    Posted 5 years ago #

    Thank you MIchael. That at least allows me to make a start. Can I expand the parameter? For example query_posts('post_type=page&id=1,4,6,9') - I want to return more than 1 page.
    Regards,

  4. MichaelH
    Member
    Posted 5 years ago #

    $args=array(
       'post_type'=>'page',
       'post__in' => array(1,4,6,9)
    );
    query_posts($args);
  5. droope
    Member
    Posted 4 years ago #

    Thank you :)

    This has been really helpful.

Topic Closed

This topic has been closed to new replies.

About this Topic