I'm using WP_Query() to pull out a few posts under a specific category "Featured" to display at the bottom of any post.
So I added <?php if (function_exists('getEditorPicks')) getEditorPicks();?> in single.php.
In functions.php, I have
wp_reset_postdata();
$args = array('cat' => 4176, 'posts_per_page' => 5);
$query = new WP_Query($args);
//return $query->query_vars;
if ($query->post_count>2) {
while ($query->have_posts()) {
$query->the_post;
echo the_title();
}
}
wp_reset_postdata();
However, it takes forever for the page to load now and it simply exhausts memory in the end.
What am I missing here?