[英]Pagination show same page WordPress
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 我只给我指向上一页的链接,但是当我单击该链接时,它仅显示同一页面,但网址从www.homepage.com更改。
to www.homepage.com/page/2 前往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);
?>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.