Query to Return Pages AND Posts
-
Hi All
I’m using twentyeleven as a theme and am modifying the “featured slider”. I write plenty of pages as well as posts and would like a query to return:
– ‘Sticky’ Posts — the default functionality; AND
– Pages that have a custom value set to 1I have been through the codex and arrived at the query below. While each of the nested arrays works alone, when I use the ‘relation’ operator it seems to return all posts.
Can anyone help me get the syntax right as I know the queries are solid.
Thanks
Ben
$featured_args = array(
'featured_query' => array(
'relation' => 'OR',
array(
'post_type' => 'page',
'post_status' => 'publish',
'meta_key' => 'featured-page', 'meta_value' => '1'
),
array(
'post__in' => $sticky,
'post_status' => 'publish',
'posts_per_page' => 10,
'no_found_rows' => true
)
)
);
- The topic ‘Query to Return Pages AND Posts’ is closed to new replies.