Site logo

Archived topic

Pagination for static blog page

3 replies · Started by Philipp on May 20, 2018

Viewing posts 1–4 of 4

Please take a look at http://www.ktf2018.ch. Here I use a static homepage page-home.php where I output the latest posts of a specific category which works so far.

The issue I have: pagination (at the bottom of the page) is not working. So URL’s like http://www.ktf2018.ch/page/2/ or http://www.ktf2018.ch/page/3/ don’t work.

Find my code here (screenshot)

Can it be related to codex.wordpress.org/Pagination (scroll down to “Static Front Page”)?

Thanks,
Philipp

That could definitely be the issue.

I also suggest using WP_Query instead of query_posts, as they show in that example.

Thank you Tom, it worked for me:

if ( get_query_var( 'paged' ) ) { $paged = get_query_var( 'paged' ); }
elseif ( get_query_var( 'page' ) ) { $paged = get_query_var( 'page' ); }
else { $paged = 1; }

$the_query = new WP_Query('posts_per_page=12&paged=' . $paged); 

?>

<?php if ( $the_query->have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post(); // run the loop ?>

You're welcome! :)

This archived topic is closed to new replies.