I'm still stuck on this issue..
The pagination on my WordPress blog is not working - http://www.example.com/news
When you click a different page number it updates the URL (and page title) correctly but it does not show different posts.
Ive tried:
Nothing has worked for me.
I've seen many solutions for a custom query, but I'm using the posts page that you set in Settings>Reading>Posts Page so I did not write any code to display the posts on this page.
UPDATE: I have not found the solution yet. I know I can do it by writing my own query but I want to stick with the default WP blog.
Look for improper code syntax if the code is there but pagination doesn't work. The line needs both the opening "lesser-than" sign (<), followed by a question mark. The code should close with a question mark, followed by a "greater-than" sign (>). If the code uses other variables, they should be well-formatted.
The easiest way to add numeric pagination in WordPress is by using the WP-PageNavi plugin. To use this plugin, you'll still need to make some changes to your theme's code, but it is a lot easier than the full code method because WP-PageNavi gives you complete control over your site's pagination.
I have played with the "posts pages" too but I'm getting no result.
Only working solution for me was a custome query in combination with the Page-Navi Plugin.
In my template i have the following code:
<?php
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$args = array(
'post_type' => 'post',
'orderby' => 'date',
'order' => 'DESC',
'post_status' => 'publish',
'posts_per_page' => 5,
'paged' => $paged,
);
$q = new WP_Query( $args );
if ( $q->have_posts() ) {
$displaylist = '<div class="list-group">';
while ( $q->have_posts() ) {
$q->the_post();
// build up your entry
unset( $displayTag );
}
$displaylist .= '</div>';
echo( $displaylist );
wp_pagenavi( array( 'query' => $q ) );
wp_reset_postdata();
}
?>
With the post_per_page
i manage the entries per site. In while loop i build up the entries that should be showed.
Check your WP loop in the category.php file (aka archive.php). It must contain the following:
if (have_posts()) : while (have_posts()) : the_post();
and finished with:
endwhile; endif;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With