项目作者: palmtreephp

项目描述 :
:palm_tree: WordPress pagination component for Palmtree PHP
高级语言: PHP
项目地址: git://github.com/palmtreephp/wp-pagination.git
创建时间: 2017-11-01T15:05:28Z
项目社区:https://github.com/palmtreephp/wp-pagination

开源协议:MIT License

下载


Palmtree WordPress Pagination

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:

  1. composer require palmtree/wp-pagination

Usage

Basic

  1. <?php
  2. $pagination = new \Palmtree\WordPress\Pagination\Pagination();
  3. // Get Bootstrap formatted pagination
  4. echo $pagination->getHtml();
  5. // __toString() is also implemented, which implicitly calls getHtml()
  6. echo $pagination;
  7. // Or get an array of unstyled links
  8. $links = $pagination->getLinks();

Advanced

  1. <?php
  2. use Palmtree\WordPress\Pagination\Pagination;
  3. $query = new \WP_Query();
  4. $pagination = new Pagination();
  5. $pagination->setQuery($query);
  6. $pagination
  7. ->addArg('prev_text', 'Previous')
  8. ->addArg('next_text', 'Next');

License

Released under the MIT license