-
-
Save billerickson/aea6917c3092116626ceb28e4203abd4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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