pagination code


Below code display the pagination in this format like
” Showing 1 – 10 of 21 players ”
players is my custom post type name.
<?php
$num_cb = 10;
$id_cb = $paged;
$r_cb=1;
$startNum_cb = $r_cb;
$endNum_cb = 10;
if($id_cb >=2) {
$s_cb=$id_cb-1;
$r_cb=($s_cb * 10) + 1;
$startNum_cb=$r_cb;
$endNum_cb=$startNum_cb + ($num_cb -1);
}
$count_posts = wp_count_posts( ‘players’ )->publish;
echo “Showing $startNum_cb – $endNum_cb of $count_posts players” ;
?>

==================================================

Below code display the pagination in this format like
” 1 2 3 > ”

<div class=”pagin”>
<span class=”paginat”>
<?php
$big = 999999999; // need an unlikely integer
echo paginate_links( array(
‘base’ => str_replace( $big, ‘%#%’, esc_url( get_pagenum_link( $big ) ) ),
‘format’ => ‘?paged=%#%’,
‘current’ => max( 1, get_query_var(‘paged’) ),
‘next_text’ => __(‘>’),
‘prev_text’ => __(‘<‘),
‘total’ => $loop->max_num_pages
) );
?>
</span>
</div>
Advertisements

23 thoughts on “pagination code

  1. We’re a gaggle of volunteers and opening a new scheme in our community.

    Your website provided us with useful info to work on. You have
    performed an impressive activity and our entire group will be grateful to
    you.

  2. I was suggested this website by my cousin. I’m not sure whether this post is written by him as nobody else
    know such detailed about my difficulty. You are amazing!
    Thanks!

  3. Magnifiсent goods frοm yoս, man. I havе understand ylur stuff previous to and you are just
    extremely great. I really like what you’ve acquired here,
    certainly like what you’re saying and tҺe way in which yοս
    ssay it. You make it entertaining and you still
    take care of too keep it sensible. I cant wait tto read far more from you.
    This iѕ actսally a ԝonderful site.

  4. Just wish to say your article is as astounding.
    The clarity in your post is just great and i could assume you’re an expert on this subject.
    Fine with your permission let me to grab your feed to keep updated with forthcoming post.

    Thanks a million and please carry on the gratifying work.

  5. Good day! This is my first visit to your blog! We are a group
    of volunteers and starting a new initiative in a community in the
    same niche. Your blog provided us beneficial information to work on. You have done a outstanding job!

  6. I want too tօ thank you for tthіs excllеnt read!! I absolutely enjoyed every little bit օf it.
    I’ve got you book marked to look at new stuff yoս post…

  7. It’s perfect time to make some plans for the future and it is time to be happy.
    I’ve read this post and if I could I want to suggest you some interesting things or tips.

    Perhaps you can write next articles referring to this article.
    I desire to read more things about it!

  8. Having read this I thought it was really enlightening.
    I appreciate you spending some time and effort to put this article together.
    I once again find myself spending way too much time both
    reading and posting comments. But so what, it was still worthwhile!

COMMENT PLEASE..!

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s