The Support Forums will be in read-only mode for a scheduled maintenance window on 01 September 2016 14:00 UTC - 20:00 UTC. More information.

[resolved] WP_Query with pages (5 posts)

  1. steadyedd
    Posted 7 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
    Posted 7 years ago #

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

  3. steadyedd
    Posted 7 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.

  4. MichaelH
    Posted 7 years ago #

       'post__in' => array(1,4,6,9)
  5. droope
    Posted 6 years ago #

    Thank you :)

    This has been really helpful.

Topic Closed

This topic has been closed to new replies.

About this Topic