I’m using this query WP_Query('post_type=product&posts_per_page=8')
I need to include a specific page into the query but not sure how to add it since I’m only specifying the custom post type? Is it possible to add in a page?
1 Answer
If I understand you correctly you want a bunch of posts from a custom post type and in some way combine it with a page. To do this you would first have to get the queried objects:
$page_id = 123; // the id of the page you want to retrieve
$cpt_objects = new WP_Query( array(
'post_type' => 'product',
'posts_per_page' => 8
));
$page_object = new WP_Query( array(
'post_type' => 'page',
'page_id' => $page_id
));
Now you can loop through the $cpt_objects
and insert the $page_object
anywhere you like.