از این استفاده کنید دوست عزیز
کد PHP:
<?php
$custom_query = new WP_Query( array(
'posts_per_page' => 5,
'cat' => -4,
'paged' => ( get_query_var( 'paged' ) ) ? absint( get_query_var( 'paged' ) ) : 1,
) );
if($custom_query->have_posts()) :
echo '<ul id="entry">';
while($custom_query->have_posts()) : $custom_query->the_post();
the_title( sprintf( '<li class="entry-title"><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ), '</a></li>' );
endwhile;
echo '</ul>';
echo '<div id="paginate">';
$big = 999999999;
echo paginate_links( array(
'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
'format' => '?paged=%#%',
'current' => max( 1, get_query_var('paged') ),
'total' => $custom_query->max_num_pages
) );
echo '</div>';
endif;
wp_reset_query();?>