// facetwp_pager_html

Overview

This filter lets you modify how the pager appears.

Parameters

  • $output | string | The pager HTML
  • $params | array | An associative array of pagination settings (see below)

$params = array(
    'page' => 1,
    'per_page' => 10,
    'total_rows' => 205,
    'total_pages' => 21
);

Usage

This example will show ALL page numbers:

add_filter( 'facetwp_pager_html', function( $output, $params ) {
    $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>';
        }
    }

    return $output;
}, 10, 2 );