Skip to content

Instantly share code, notes, and snippets.

@billerickson
Created March 5, 2019 21:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save billerickson/aea6917c3092116626ceb28e4203abd4 to your computer and use it in GitHub Desktop.
Save billerickson/aea6917c3092116626ceb28e4203abd4 to your computer and use it in GitHub Desktop.
<?php
/**
* FacetWP Pagination, all links, prev/next arrows
*
*/
add_filter( 'facetwp_pager_html', function( $output, $params ) {
// All Links
$output = '';
if ( 1 < $params['total_pages'] ) {
for ( $i = 1; $i <= $params['total_pages']; $i++ ) {
$is_curr = ( $i === $params['page'] ) ? ' active' : '';
$output .= '<a class="facetwp-page' . $is_curr . '" data-page="' . $i . '">' . $i . '</a>';
}
}
// Prev / Next
if( $params['page'] > 1 )
$output = '<a class="facetwp-page" data-page="' . intval( $params['page'] - 1 ) . '">' . ea_icon( 'arrow-left' ) . '</a>' . $output;
if( $params['page'] < $params['total_pages'] )
$output .= '<a class="facetwp-page" data-page="' . intval( $params['page'] + 1 ) . '">' . ea_icon( 'arrow-right' ) . '</a>';
$output = '<nav class="posts-navigation">' . $output . '</output>';
return $output;
}, 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment