Change class=”page-numbers” in pagination

Question

I’m using the following code (from here) to paginate links:

function custom_pagination() {
    global $wp_query;
    $big = 999999999; // need an unlikely integer
    $pages = paginate_links( array(
            'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
            'format' => '?paged=%#%',
            'current' => max( 1, get_query_var('paged') ),
            'total' => $wp_query->max_num_pages,
            'prev_next' => false,
            'type'  => 'array',
            'prev_next'   => TRUE,
            'prev_text'    => __('«'),
            'next_text'    => __('»'),
        ) );
        if( is_array( $pages ) ) {
            $paged = ( get_query_var('paged') == 0 ) ? 1 : get_query_var('paged');
            echo '<ul class="pagination">';
            foreach ( $pages as $page ) {
                    echo "<li>$page</li>";
            }
           echo '</ul>';
        }
}

The output of this is using echo custom_pagination();:

<ul class="pagination">
    <li class="page-item">
        <a class="page-numbers" href="example.com/page/1">1</a>          
    </li>
</ul>

How can I change the output to this?:

<ul class="pagination">
    <li class="page-item">
        <a class="page-link" href="example.com/page/1">1</a>          
    </li>
</ul>

I’m trying to make a bootstrap theme, but I can’t seem to replace the page-numbers class with the bootstrap page-link class.

0
Tom 4 months 0 Answers 15 views 0

Leave an answer