简体   繁体   English

Wordpress 3.5查询分页无法正常运行

[英]Wordpress 3.5 query pagination not functioning properly

I am using Wordpress and a static homepage and a posts page to display all my news posts located here: http://www.bigideaadv.com/uptous/?page_id=13 我正在使用Wordpress和一个静态主页以及一个帖子页面来显示我位于这里的所有新闻帖子: http : //www.bigideaadv.com/uptous/?page_id=13

The pagination only works on page 1 and 2. Page 3 causes errors. 分页仅在第1页和第2页上起作用。第3页导致错误。 Also, if I try and add more posts, the pagination doesn't go above three pages. 另外,如果我尝试添加更多帖子,则分页不会超过三页。

Does anyone have any thoughts? 有人有想法吗?

Posts query to follow: 帖子查询如下:

    $posts = query_posts($query_string.'&orderby=title&order=asc&posts_per_page=4&paged='.$paged);

Here is a simple way to do pagination without any plugin : 这是无需任何插件即可进行分页的简单方法:

global $wp_query;
$big = 999999999; // need an unlikely integer
echo paginate_links( array(
  'base' => str_replace( $big, '%#%', get_pagenum_link( $big ) ),
  'format' => '?paged=%#%',
  'current' => max( 1, get_query_var('paged') ),
  'total' => $wp_query->max_num_pages
) );

Put it in your index.php and it should works ! 把它放在您的index.php中,它应该可以工作!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM