I am using a function in functions.php to get posts and pages displayed on the homepage.
add_filter( 'pre_get_posts', 'my_get_posts' );
function my_get_posts( $query ) {
if ( is_home()) {
$query->set( 'post_type', array( 'post', 'page') );
$query = apply_filters( 'the_content', $query);
return $query;
}
}
I noticed that by doing this, the page does not render shortcodes and ignores the fact that a page template is assigned to the page. So I tried using passing the return $query through a filter like so
$query = apply_filters( ‘the_content’, $query);
but then I get this error Object of class WP_Query could not be converted to string
I don’t know any way around it. Do you?