palmtree / wp-pagination
WordPress Pagination component for Palmtree PHP
Installs: 3 195
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 1
Open Issues: 0
Requires
- php: >=7.1
Requires (Dev)
- palmtree/php-cs-fixer-config: ^1.0.3
- roots/wordpress: ^5.7
README
WordPress pagination component for Palmtree PHP
Generates pagination for the main WP_Query or any query provided and outputs with Bootstrap v4 classes.
Requirements
- PHP >= 7.1
Installation
Use composer to add the package to your dependencies:
composer require palmtree/wp-pagination
Usage
Basic
<?php $pagination = new \Palmtree\WordPress\Pagination\Pagination(); // Get Bootstrap formatted pagination echo $pagination->getHtml(); // __toString() is also implemented, which implicitly calls getHtml() echo $pagination; // Or get an array of unstyled links $links = $pagination->getLinks();
Advanced
<?php use Palmtree\WordPress\Pagination\Pagination; $query = new \WP_Query(); $pagination = new Pagination(); $pagination->setQuery($query); $pagination ->addArg('prev_text', 'Previous') ->addArg('next_text', 'Next');
License
Released under the MIT license