PHP code example of palmtree / wp-pagination

1. Go to this page and download the library: Download palmtree/wp-pagination library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

palmtree / wp-pagination example snippets



$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();



use Palmtree\WordPress\Pagination\Pagination;

$query = new \WP_Query();

$pagination = new Pagination();
$pagination->setQuery($query);
$pagination
    ->addArg('prev_text', 'Previous')
    ->addArg('next_text', 'Next');