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 am using a function in functions.php to get posts and pages displayed on the homepage.
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
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?
It's because you're trying to return an object. You have to use references.
i.e.