WordPress Using WP_Query() object


Example

Creating a separate instance of the WP_Query object is easy:

$query_args = array(
                'post_type' => 'post',
                'post_per_page' => 10
            ); 

$my_query = new WP_Query($query_args);

if( $my_query->have_posts() ):
    while( $my_query->have_posts() ): $my_query->the_post();
       //My custom query loop
    endwhile;
endif;

wp_reset_postdata();

Notice that you need to build the query arguments array to your specification. For more details, look at WP_Query codex page.