Im facing issues with wordpress digital download website for pagination on homepage.
Below pages doesn't seem to work with pagination when I go navigate through pagination, it shows 404 page.
[www.domain.com/page/2/][1] [www.domain.com/page/3/][1]
But when I edit the links e.g below it works:
[www.domain.com/downloads/page/2/][1] [www.domain.com/downloads/page/3/][1]
Why it is happening, same homepage code works fine with archives/categories/tags but not for homepage, I have been searching for this from yesterday and I couldn't find any solution: Below My code for homepage Your help is much appreciated
<?php
$store_page_setting = (is_front_page() && is_page_template('edd-store-front.php') ? 'page' : 'paged' );
$current_page = get_query_var( $store_page_setting );
$per_page = intval( get_theme_mod( 'bwpy_store_front_count', 3 ) );
$offset = $current_page > 0 ? $per_page * ( $current_page-1 ) : 0;
$product_args = array(
'post_type' => 'download',
'posts_per_page' => $per_page,
'offset' => $offset
);
$products = new WP_Query( $product_args );
if ( $products->have_posts() ) : ?>
<?php
while ( $products->have_posts() ) : $products->the_post();
// <!-- html code -->
endwhile;
?>
<!-- Pagination -->
<div class="store-pagination">
<?php
$big = 999999999;
echo paginate_links( array(
'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
'format' => '?paged=%#%',
'current' => max( 1, $current_page ),
'total' => $products->max_num_pages
) );
?>
</div>
<?php else : ?>
<article id="post-0" class="post no-results not-found">
<!-- something -->
</article>
<?php endif; ?>