facetwp_facet_pager_link
Overview
This filter – available since FacetWP v4.0 – lets you modify the pager links output of the Pager facet, if the Pager type is set to “Page numbers”.
Parameters
- $html | string | The pager link HTML
- $params | array | An associative array of pager link data (see below)
$params = [
'page' => 5, // The page link number (integer)
'label' => 'Next', // The page link text (string, or integer if it is a number)
'extra_class' => 'last', // The page link extra class: 'first', 'last', 'next', 'prev', 'dots' (string)
];
Usage
This example adds a sr-only
class to the last page link:
add_filter( 'facetwp_facet_pager_link', function( $html, $params ) {
if ( 'last' == $params['extra_class'] ) {
$html = str_replace( 'last', 'last sr-only', $html );
}
return $html;
}, 10, 2 );