Skip to content

cyrilchandelier/WordPressAdminPagination

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

WordPressAdminPagination

Easy to integrate WordPress admin style pagination for themes and plugins ScreenShot

Installation

Copy the WordPressAdminPagination.php file into your theme or plugin (for instance in a Externals/WordPressAdminPagination/ folder).

Include or require the script in order to use it:

require_once 'WordPressAdminPagination.php';

This class uses PHP namespaces so you should use CC; or prefix your object creation with \CC if necessary.

How to use

Create a pagination object and configure it by setting the totalItems property:

$pagination = new \CC\WordPressAdminPagination();
$pagination->totalItems = $currentCount;

To display the pagination component in your template, just call the show() method on your pagination object:

<?php $pagination->show(); ?>

In order to use the common WordPress admin style, this call should be done in a tablenav (top or bottom) div:

<div class="tablenav top">
    <?php $pagination->show(); ?>
    <br class="clear">
</div>

Options

The max number of displayed items can be changed by setting a new limit to the pagination object (default is 25):

$pagination->limit = 50;

The URL parameters used for pagination can be changed by settings a new string to the pagination object (default is "paged"):

$pagination->parameter = "p";

About

Easy to integrate WordPress admin style pagination for themes and plugins

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages