next_posts_link not working in custom loop

only just use echo and get_

<?php $args = array(
     'post_type' => 'post',
     'posts_per_page' => 1
);

$my_query = null;
$my_query = new WP_Query($args);
if( $my_query->have_posts() ) {
    $i = 0;
    while ($my_query->have_posts()) : $my_query->the_post();
        if($i % 2 == 0) { ?>
        <div class="row"><?php } ?>
            <div class="col-md-6">
                <div class="overview">
                   <!-- Post details here -->
                </div>
            </div>
            <?php $i++; if($i != 0 && $i % 2 == 0) { ?>
        </div><!--/.row-->
        <div class="clearfix"></div>
            <?php }
        endwhile; ?>
        <nav class="pagination">
            <button class="btn-whole"><?php echo get_previous_posts_link('Previous'); ?></button>
            <button class="btn-whole"><?php echo get_next_posts_link('Next'); ?></button>
        </nav>
<?php } wp_reset_query(); ?>

Leave a Comment