WordPress.org

Ready to get started?Download WordPress

Plugin Directory

TW Pagination

TW Pagination is a simple and flexible pagination plugin which provides users with better navigation on your WordPress site.

How can I override the default pagination settings?

The tw_pagination() and tw_pagination_comments() functions each takes two optional arguments. Second argument is in query string format, which allows you to override the global settings. The available options are:

  • title - The text/HTML to display before the pagination links
  • nextpage - The text/HTML to use for the next page link
  • previouspage - The text/HTML to use for the previous page link
  • before - The text/HTML to add before the pagination links
  • after - The text/HTML to add after the pagination links
  • empty - Display before markup and after markup code even when the page list is empty
  • range - The number of page links to show before and after the current page
  • anchor - The number of links to always show at beginning and end of pagination
  • gap - The minimum number of pages before a gap is replaced with an ellipsis (...)

You can even control the current page and number of pages with:

  • page - The current page. This function will automatically determine the value
  • pages - The total number of pages. This function will automatically determine the value

Examples (also applies to tw_pagination_comments()):

1) To paginate custom WP_Query:

<?php 
    $the_query = new WP_Query( $args ); 
    while($the_query->have_posts()) : $the_query->the_post();
    // your code
    endwhile;

    if(function_exists('tw_pagination')) 
        tw_pagination($the_query, 'range=4&anchor=2&nextpage=Next&previouspage=Previous');
?>

2) To paginate default WP_Query with custom settings

<?php if(function_exists('tw_pagination')) 
    tw_pagination('global', 'range=4&anchor=2&nextpage=Next&previouspage=Previous');
?>

3) To paginate default WP_Query

<?php if(function_exists('tw_pagination')) 
    tw_pagination();
?>

How can I style the comments pagination differently than the posts pagination?

When calling tw_pagination_comments(), TW Pagination adds an extra class to the ol element, tw-pagination-comments.

This allows you to use the .tw-pagination-comments styles, already in tw-pagination.css, to override the default styles.

Requires: 2.2.0 (2.7.0 for comments pagination) or higher
Compatible up to: 3.4.2
Last Updated: 2012-11-22
Downloads: 12,336

Ratings

5 stars
5 out of 5 stars

Support

Got something to say? Need help?

Compatibility

+
=
Not enough data

0 people say it works.
0 people say it's broken.

100,2,2
100,1,1
0,1,0
100,1,1