Wordpress paginate_links function does not work on homepage

by Iury Vasconcelos   Last Updated September 14, 2018 15:08 PM

When the 'news' page is not on the main page the pagination happens normally, and you can change the page to other 'news'. Now when it is set to the main page it is not possible to change go to page 2, for example to see other 'news', in the address bar changes but the screen continues the same 'news' from page 1. Here is the code used:

echo paginate_links( array(
'prev_next' => false,
'base' => str_replace( 999999999, '%#%', esc_url( get_pagenum_link( 999999999 ) ) ),
'format' => '?paged=%#%',
'current' => max( 1, get_query_var('paged') ),
'total' => $postslist->max_num_pages
) );

I discovered the following error:

in the address bar when the 'news' page is not the main one, it's like this "mysite /news/page/2/" there you can see the 'news' on page 2;

Now when the news is like the main page it is thus "mysite/page/2/" and there the code does not identify that it is the 'news' page and does not display page 2

Can i solve this problem?

Tags : php


Related Questions