You were not passing any limit to the query.
$args = array(
'posts_per_page' => 3,
'post_type' => 'post',
'post_status' => 'publish',
'ignore_sticky_posts' => true
);
$children = new WP_Query($args);
if ($children->have_posts()) {
while ($children->have_posts()) {
$children->the_post();
// get_template_part( 'header', 'blogheader' ); // not on my server :)
}
}
wp_reset_postdata();
I made a couple of changes. You were querying for ‘posts’ with a function called get_pages
. While that function does accept a post_type
argument using WP_Query
is neater.
I added ignore_sticky_posts
. Without that you won’t get the latest posts, you’ll get sticky posts and then the latest ones.
I don’t know what is in header-blogheader.php
but it is possible that it is written in such a way that things still do not work.