6

I set the pagination parameters in functions.php and echoed where I want the links to appear, so far so good.

The problem is that the previous and next texts are not modifying. I put a random text to see what appears. The texts of the images below are shown, they are even translated into my language (pt-br)...

How can i modify them?

enter image description here

enter image description here

<?php $args = array(
'base'               => '%_%',
'format'             => '?paged=%#%',
'total'              => 1,
'current'            => 0,
'show_all'           => false,
'end_size'           => 1,
'mid_size'           => 2,
'prev_next'          => true,
'prev_text'          => __('jdsjj'),
'next_text'          => __('jhdsh'),
'type'               => 'list',
'add_args'           => false,
'add_fragment'       => '',
'before_page_number' => '',
'after_page_number'  => ''); ?>

<!-- Pagination links echoed in my home page -->
<?php echo paginate_links( $args ); ?>

2 Answers 2

7

I found out a way that you can place any text. You just need to create an array where you want the paginate_links to appear.

<!-- Put this in your functions.php -->
<?php $args = array(
   'base'               => '%_%',
   'format'             => '?paged=%#%',
   'total'              => 1,
   'current'            => 0,
   'show_all'           => false,
   'end_size'           => 1,
   'mid_size'           => 2,
   'add_args'           => false,
   'add_fragment'       => '',
   'before_page_number' => '',
   'after_page_number'  => ''); ?>

<!-- Put this where you want the paginate_links to appear -->
<?php echo paginate_links( array(

  'prev_text' => '<span>Any text Previous</span>',
  'next_text' => '<span>Any text Next</span>'

)); ?>
2

are you using WordPress in default "en" language? there might be a translations of prev_text & next_text stored in "po/mo" files. & if you are using language other then default then maybe the system is using translated string from mo file. try removing these two keys and values from array for a while to see what happens.

'prev_text'          => __('jdsjj'),
'next_text'          => __('jhdsh'),

also after that trial remove get text helper function too. and see the result.

'prev_text'          => 'jdsjj',
'next_text'          => 'jhdsh',

if the problem is because of "Languages" then the complete solution is to rewrite all of your mo files from up to date pot

6
  • I removed and changed the way you showed, but did not change anything. What I want is to be able to change the text to anything. Do you know why the array is not allowing this? Jan 25, 2017 at 19:58
  • @Gabriel Souza this may be cause of site language. are you using default english language or any other language then english?
    – Anwer AR
    Jan 25, 2017 at 20:24
  • i'm using portuguese from Brazil Jan 25, 2017 at 20:47
  • switch the language to default ( English ) to see if the changes are working? if it does then as i told you before you have to re generate the mo files from up to date pot. which is located in your theme's language directory.
    – Anwer AR
    Jan 25, 2017 at 21:30
  • It did not work. How do I re generate these files? Jan 25, 2017 at 21:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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