A broken WordPress pagination can be due to many errors. In this example, we will be looking at pages unchanged even though the page numbers change.

Usually to solve the issue of posts remaining the same while you select a different page from your pagination; you would need to pass an extra parameter in your posts query string. This parameter is displayed below:

 

PHP

'paged' => get_query_var('paged')

 

So in a real world scenario, like in your template’s index.html file, it would look a little something like this:

 

$query_string = array( 'paged' => get_query_var('paged') );

query_posts($query_string);

 

if ( have_posts() ) : while ( have_posts() ) : the_post();

...etc

 

 



View More Tutorials

See more posts on tutorials.

Wordpress, PHP, JavaScript, jQuery, CSS, HTML, MYSQL and more!

Categorised As:The Internet, Tutorials
COMMENTS