Skip to content

Instantly share code, notes, and snippets.

@mgibbs189 mgibbs189/functions.php

Last active Mar 2, 2017
Embed
What would you like to do?
FacetWP - pager show all pages
<?php
add_filter( 'facetwp_pager_html', function( $output, $params ) {
$output = '';
$page = (int) $params['page'];
$per_page = (int) $params['per_page'];
$total_rows = (int) $params['total_rows'];
$total_pages = (int) $params['total_pages'];
if ( 1 < $total_pages ) {
$output .= '<span class="facetwp-pager-label">' . "Page $page of $total_pages</span>";
for ( $i = 1; $i <= $total_pages; $i++ ) {
$is_curr = ( $i === $page ) ? ' active' : '';
$output .= '<a class="facetwp-page' . $is_curr . '" data-page="' . $i . '">' . $i . '</a>';
}
}
return $output;
}, 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.