FacetWP – pager show all pages

mgibbs189

{{gist file=”functions.php” lang=”php”}}
<?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 );

{{/gist}}