I have a custom static frontpage that show recent blogg updates.
But I cant seem to figure out why the pagination doesn't work? I gives me only the link to previous page but when I click the link it just shows the same page but the url changes from www.homepage.com
to www.homepage.com/page/2
this is my loop.
<?php query_posts('posts_per_page=2&category=blogg'); ?> <?php while (have_posts()) : the_post(); ?>
<?php if ( (function_exists('has_post_thumbnail')) && (has_post_thumbnail()) ) : /* if post has post thumbnail */ ?>
<div class="image"><a href="<?php the_permalink(); ?>"><?php the_post_thumbnail('archive-preview'); ?></a></div>
<?php endif; ?>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?>
<?php endwhile; ?>
<br/>
<?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); } else { ?>
<?php next_posts_link(__('← Older Entries', 'framework')) ?>
<?php previous_posts_link(__('Newer Entries →', 'framework')) ?>
<?php } ?>
lease use the code it will help you:
<?php
if ( get_query_var('paged') ) { $paged = get_query_var('paged'); }
elseif ( get_query_var('page') ) { $paged = get_query_var('page'); }
else { $paged = 1; }
query_posts('posts_per_page=3&paged=' . $paged);
?>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.