1

I'm using paginate_links to paginate the results of a loop.

I want to style the pagination using dots instead of numbers, but I'm not sure how to go about doing this.

I could try to play around with the css but I would prefer a clean method.

example.

<-                 o o o                ->

currently.

<-                 1 2 3                ->

This is currently how I am outputting my links.

<?php

$big = 999999999;

$paginate_links = paginate_links( array(
    'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
    'format' => '?paged=%#%',
    'current' => max( 1, get_query_var('paged') ),
    'total' => $the_query->max_num_pages,
    'prev_text'    => __('<div class="prev pull-left"><i class="icon-arrow_thin_left"></i></div>'),
    'next_text'    => __('<div class="next pull-right"><i class="icon-arrow_thin_right"></i></div>'),
    'type' => 'array',
    'n_display' => 'test'
) );

foreach ( $paginate_links as $pgl ) {
    echo "$pgl";
}

?>

Looking at the core paginate_links() function in Wordpress is there anyway I can modify the output of $n_display before or after.

  • I'd say CSS is the better way to go. You are, I think, intending to alter the display of pagination, not its meaning so CSS is a the right answer. Plus, dots will mean nothing to visitors on a screen reader. – Will Jan 30 '14 at 21:59
1

There is no clean way to do this (that I notice from quick look at rather messy code of it), but $n_display is passed though formatting number_format_i18n() function which does have a filter.

So you could try something like:

function make_number_into_dot( $number ) {
    return 'o';
}

add_filter( 'number_format_i18n', 'make_number_into_dot' );

// your pagination handling here

remove_filter( 'number_format_i18n', 'make_number_into_dot' );
| improve this answer | |
  • Thanks! I'm still learning and your queryposts website should help me out a lot. – hyperdrive Jan 31 '14 at 19:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.