【问题标题】:Kriesi pagination not workingKriesi 分页不起作用
【发布时间】:2015-05-15 04:04:19
【问题描述】:

我需要有关 kriesi 分页的帮助...我可以看到它,但它不起作用。当我点击第 2 页时,它会显示第一页的内容。

<?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; ?>
<?php query_posts( array
    (   'post_type'=>'post',
        'posts_per_page' => 3,
        'paged' => $paged
        )); ?>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    <article id="post-<?php the_ID(); ?>" class="middle-post">
        <h1><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h1>
    </article>
<?php endwhile; kriesi_pagination();  endif;  wp_reset_query();   ?>

【问题讨论】:

  • 我刚刚意识到它不仅仅在主页上工作。谁能告诉我这是为什么?
  • 我的回答解决了你的问题吗?

标签: php html css wordpress pagination


【解决方案1】:

很可能您的$paged 变量设置不正确。您可以尝试以下代码,而不是您的第一行:

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

【讨论】:

  • 是的,非常感谢!我尝试了许多解决方案,但没有一个有效。再次感谢!
  • 请告诉我怎么做,我找不到选项。
  • 在答案左侧的数字(当前为“0”)下,您可以找到“已选中”图标。只需单击它。仅供参考,数字顶部和底部的箭头用于对问题/答案投赞成票和反对票。
  • 当然,我知道 :) 问题是我不能投票,因为我需要 15 名声望...我想我可以将这篇文章标记为已完成
  • True :) 没关系,虽然你看不到“已选中”图标很奇怪(要清楚:与此处相同:stackoverflow.com/questions/28836291/…
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2013-08-27
  • 1970-01-01
  • 1970-01-01
  • 2017-10-22
  • 2016-02-07
  • 2017-09-13
相关资源
最近更新 更多