• Resolved mattiafrigeri

    (@mattiafrigeri)


    Hi, I am using this code to make a pagination:

    <?php
    global $wp_query;
    
    $big = 999999999; // need an unlikely integer
    
    echo 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
    ) );
    ?>

    grabbed here at the codex: https://codex.www.ads-software.com/Function_Reference/paginate_links

    Anyway, it outputs “previous” and “next”, and I am trying to find a way to replace those two words with text chosen by me, but I don’t see the option.

    Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • those are the aguments:

    'prev_text'    => __('? Previous'),
        'next_text'    => __('Next ?'),

    add them to the list in your args array, with new texts;

    example:

    echo 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_text'    => 'the new Previous text',
        'next_text'    => 'the new Next text'
    ) );

    be aware that you have to add a comma to the end of the line after $wp_query->max_num_pages

    Thread Starter mattiafrigeri

    (@mattiafrigeri)

    Hi Alchymyth, that works! Many thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Change "next" and "previous" text in pagination’ is closed to new replies.