Forums

How to query posts AND pages (3 posts)

  1. kjeft
    Member
    Posted 2 years ago #

    Hey all,

    I am using a star rating plugin to rate my posts and pages. I now want to display the top rated, but it seems as though the WP query function is not returning pages, only posts.

    Is there a way to work around this?

    Thanks

  2. MichaelH
    Volunteer
    Posted 2 years ago #

    You didn't describe the "WP query function" you are using but the 'post_type'=>'pages' is normally used when trying to return pages.

  3. shellyd
    Member
    Posted 1 year ago #

    I'm looking for a way to use query_posts to pull pages and posts. Specifically, I'm trying to get a sllider to display 3 specific pages as well as the most recent post in a particular category, but can't figure out how to modify query_post to do that.

    Here's the original code calling the three pages:

    query_posts(array('post_type' => 'page',
    						'orderby' => 'menu_order',
    						'order' => 'ASC',
    						'post__in' => get_option('simplepress_feat_pages'),
    						'showposts' => 3));

    I tried

    query_posts(array('post_type' => 'page',
    						'orderby' => 'menu_order',
    						'order' => 'ASC',
    						'post__in' => get_option('simplepress_feat_pages'),
    						'showposts' => 3),
    						array(
    						'post-type' => 'post',
    						'cat' => 4,
    						'order' => 'ASC',
    						'showposts' => 1));

    but that didn't quite cut it. Any ideas?

Topic Closed

This topic has been closed to new replies.

About this Topic