I have thousands of posts that i am displaying on my home page. I want to control number of posts so for this i am using `posts_per_page `but it is not working for me.<br>
I am also resetting query before this loop using `wp_reset_query();`  and tried this code in functions.php as well.

    add_action( 'pre_get_posts',  'set_posts_per_page'  );
    function set_posts_per_page( $query ) {
    global $wp_the_query;
    $query->set( 'posts_per_page', 10 );
    return $query;
    }
But nothing working for me. I am using covert store builder theme. Any suggestion will be much appreciated.
Thank you!

Here is complete code for this loop.

    wp_reset_query(); 
    $args = Array('meta_key' => '_imwb_zonpress_post_ctr',
    'orderby' => 'meta_value_num',
    'order' => 'DESC',
    'posts_per_page' => 1,
    'paged' => get_query_var( 'page' ) ,
    );
    $fpexcludecats = imwb_zonpress_get_option('fpexcludecats');
    if(!empty($fpexcludecats)) {
    $cats = explode(",", htmlspecialchars(imwb_zonpress_get_option('fpexcludecats')) );
    foreach ($cats as $key => $value) {
    $cats[$key] = "-".$value;
     }  
    $args = array_merge($args, Array('cat' => implode(',', $cats)));
    }
    $query = new WP_Query( $args );
    global $wp_query;
    // Put default query object in a temp variable
    $tmp_query = $wp_query;
    // Now wipe it out completely
    $wp_query = null;
    // Re-populate the global with our custom query
    $wp_query = $query;
    <?php while($query->have_posts()): $query->the_post();?> 
    if($num_ads_to_show && $ads_shown < $num_ads_to_show && $posts_b4_ads == 0) {
    $posts_b4_ads = mt_rand(imwb_zonpress_get_ads_option('postsshownfrom'), imwb_zonpress_get_ads_option('postsshownto'));
    $advert = imwb_zonpress_get_advert($ads_shown++);
    ?>
<li class="post advert">
    <h1 class="title"><?php echo $advert['title'];?></h1>
    <div class="content">
    <?php echo do_shortcode($advert['content']);?>
    </div></li>
    <?php } 
     $zp_is_product = false;
     $ctr_track_attr = "";
    if(imwb_zonpress_is_product()) {
     $zp_is_product = true;
    $ctr_track_attr = " class='zp-ctr-track' data-post-item='".get_the_ID()."'";  
     }

Then there is some code to display image, title and excerpt and i think this should not effect number of posts. After this these lines are given

    <?php 
    $posts_b4_ads--;
    endwhile; ?>