7 years ago
<?php
// Add this to functions.php
add_filter( 'facetwp_pager_html', function( $output, $params ) {
$output = str_replace( '<<', '←', $output );
$output = str_replace( '>>', '→', $output );
return $output;
}, 10, 2 );
7 years ago
<?php
/** basic string replace to add nofollow to pager html **/
add_filter( 'facetwp_pager_html', function( $output, $params ) {
$output = str_replace( 'a class="facetwp-page', 'a rel="nofollow" class="facetwp-page', $output );
return $output;
}, 10, 2 );
8 years ago
<?php
add_filter( 'facetwp_pager_html', function( $output, $params ) {
$output = '';
$page = $params['page'];
$total_pages = $params['total_pages'];
if ( 1 < $total_pages ) {
// Previous page (NEW)
if ( $page > 1 ) {
$output .= '<a class="facetwp-page" data-page="' . ($page - 1) . '">Previous</a>';
}
if ( 3 < $page ) {
$output .= '<a class="facetwp-page first-page" data-page="1"><<</a>';
}
if ( 1 < ( $page - 10 ) ) {
$output .= '<a class="facetwp-page" data-page="' . ($page - 10) . '">' . ($page - 10) . '</a>';
}
for ( $i = 2; $i > 0; $i-- ) {
if ( 0 < ( $page - $i ) ) {
$output .= '<a class="facetwp-page" data-page="' . ($page - $i) . '">' . ($page - $i) . '</a>';
}
}
// Current page
$output .= '<a class="facetwp-page active" data-page="' . $page . '">' . $page . '</a>';
for ( $i = 1; $i <= 2; $i++ ) {
if ( $total_pages >= ( $page + $i ) ) {
$output .= '<a class="facetwp-page" data-page="' . ($page + $i) . '">' . ($page + $i) . '</a>';
}
}
if ( $total_pages > ( $page + 10 ) ) {
$output .= '<a class="facetwp-page" data-page="' . ($page + 10) . '">' . ($page + 10) . '</a>';
}
if ( $total_pages > ( $page + 2 ) ) {
$output .= '<a class="facetwp-page last-page" data-page="' . $total_pages . '">>></a>';
}
// Next page (NEW)
if ( $page < $total_pages ) {
$output .= '<a class="facetwp-page" data-page="' . ($page + 1) . '">Next</a>';
}
}
return $output;
}, 10, 2 );
8 years ago
<?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 );