You can use this code to get 3 posts from category Featured
$args = array(
'category_name' => 'featured',
'posts_per_page' => 3
);
$featured_posts = new WP_Query( $args );
if ( $featured_posts->have_posts() ):
while ( $featured_posts->have_posts() ):
$featured_posts->the_post();
// Here you can use the normal loop functions like 'the_title()' to display your
// 3 posts from the category 'Featured'
endwhile;
endif;
After this code, it’s important you place the following line:
wp_reset_postdata();
After looping through a separate query, this function restores the
$post
global to the current post in the main query.
Edit
You can use the following code to get a loop with pagination enabled:
$paged = ( get_query_var( 'paged' ) )? absint( get_query_var( 'paged' ) ): 1;
$args = array(
'posts_per_page' => get_option( 'posts_per_page' ),
'paged' => $paged
);
$posts = new WP_Query( $args );
// Merge the two results
$posts->posts = array_merge( $posts->posts, $featured_posts->posts );
// Increase the post_count to display all the items in the merged posts array
$posts->post_count += $featured_posts->post_count;
if ( $posts->have_posts() ):
while ( $posts->have_posts() ):
$posts->the_post();
// Here you can use the normal loop functions like 'the_title()' to display your
// posts from the category 'Featured'
endwhile;
endif;