I'm trying to get a Page to display a custom query using the snippet posted here. The following is in my functions.php
:
function alter_the_query($request) {
$dummy_query = new WP_Query(); // the query isn't run if we don't pass any query vars
$dummy_query->parse_query($request);
// this is the actual manipulation; do whatever you need here
if($dummy_query->is_page('blog')) $request['category_name'] = 'Blog';
// and then
return $request;
}
add_filter('request','alter_the_query');
The page called "Blog" has a basic loop inside- so it should be displaying whatever WP_Query
tells it to. However, it is only displaying the Page content- which should have been ignored.
I can't seem to find a reference that explains the properties of the $request
object, so I'm not sure what I should do to make this snippet work. Any ideas?