Now i tried to go pdf-market.ir/?paged=2 but it’s show 404 Error !
check site, site search
i 1day tried to solve this problem but don’t succed.
my codes for loop in index.php
<ul class="page_result">
<?php
//$paged = (get_query_var('page')) ? get_query_var('page') : 1;
$args = array(
'post_type' => 'product',
'stock' => 1,
'posts_per_page' => 16,
'orderby' => 'date',
'order' => 'DESC',
'paged' => 1,
);
$loop = new WP_Query( $args );
while ( $loop->have_posts() ) : $loop->the_post(); global $product; ?>
<div class="bookbox">
<a id="id-<?php the_id(); ?>" href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
<div class="bookbox-img">
<?php if (has_post_thumbnail( $loop->post->ID )) echo get_the_post_thumbnail($loop->post->ID, 'shop_catalog'); else echo '<img src="'.woocommerce_placeholder_img_src().'" alt="Placeholder" style="margin-left: -20px" width="200px" height="200px" />'; ?>
</div>
</a>
<div class="bookbox-bookname"><a data-tooltip="<?php the_title(); ?>" class="bookname tooltip" href="<?php the_permalink(); ?>"><?php the_title(); ?></a></div>
<?php $mid_var = get_post_meta($post->ID, 'پدÛداÙرÙدÙ',true);
if(isset($mid_var) && !empty($mid_var)) : ?>
<div class="bookbox-dtibook"><span class="garyYekan10">پدÛدآÙرÙدÙ:</span>
<?php echo get_post_meta($post->ID, 'پدÛداÙرÙدÙ',true); ?>
</div><?php endif; ?>
<?php $mid_var = get_post_meta($post->ID, 'Ùاشر',true);
if(isset($mid_var) && !empty($mid_var)) : ?>
<div class="bookbox-dtibook"><span class="garyYekan10">Ùاشر: </span>
<?php echo get_post_meta($post->ID, 'Ùاشر',true); ?>
</div>
<?php endif; ?>
<?php $mid_var = get_post_meta($post->ID, 'ÙÙبت Úاپ',true);
if(isset($mid_var) && !empty($mid_var)) : ?>
<div class="bookbox-dtibook"><span class="garyYekan10">ÙÙبت Úاپ:</span>
<?php echo get_post_meta($post->ID, 'ÙÙبت Úاپ',true); ?>
</div>
<?php endif; ?>
<div class="bookbox-price"><span class="garytahoma8">ÙÛÙ
ت: </span> <?php woocommerce_template_loop_price() ?> </div>
<?php $mid_var = get_post_meta($post->ID, 'Ù
ÙجÙدÛ',true);
if(isset($mid_var) && !empty($mid_var)) : ?>
<div class="bookbox-price"><span class="garytahoma8">Ù
ÙجÙدÛ: </span><span class="fontgreen10">
<?php echo get_post_meta($post->ID, 'Ù
ÙجÙدÛ',true); ?>
</span> </div><?php endif; ?>
<a alt="Ù
شخصات کتاب" href="<?php the_permalink(); ?>"><div title="Ù
شخصات کتاب" alt="Ù
شخصات کتاب" class="bookbox-bookinfo"></div></a>
<a alt="خرÛد کتاب" href="<?php the_permalink(); ?>&add-to-cart=<?php the_id(); ?>">
<div alt="خرÛد کتاب" class="bookbox-addcart"></div>
</a>
</div>
<?php endwhile; ?>
<?php wp_reset_postdata(); ?>
</ul>
<div class="pagination">
<?php
wp_pagination(); ?>
</div>
and my code in function.php > pagination
<?php
function wp_pagination() {
global $wp_query;
$big = 12345678;
$page_format = paginate_links( array(
'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
'format' => '?paged=%#%',
'current' => max( 1, get_query_var('paged') ),
'total' => $wp_query->max_num_pages,
'type' => 'array'
) );
if( is_array($page_format) ) {
$paged = ( get_query_var('paged') == 0 ) ? 1 : get_query_var('paged');
echo '<div><ul>';
foreach ( $page_format as $page ) {
echo "<li>$page</li>";
}
echo '</ul></div>';
}
}
?>
this is all…
in searches and archives is show pagination but
in home page and example:site.com dont show pagination and it’s place just free and no code…
Try this code this will work for you
Put this code in your functions.php file.
css for pagination.
I hope this will work for you