问题描述
|
我被困住了。我一直在尝试使用
query_posts( array(\'category_name\'=>\'news\',\'posts_per_page\' => 2,\'paged\' => $paged)
覆盖类别存档中返回的帖子的默认数量
问题是它在第一页上返回正确的结果,当我转到较旧的查询时,$wp_query->request
查询而不是显示showing2ѭ显示LIMIT 10,10
表明正在使用每页默认帖子。
<?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( array(\'category\'=>\'news\',\'posts_per_page\' => 4,\'paged\' => $paged));
if (have_posts()) : ?> <div class=\"arch-wrap\">
<?PHP
while ($query->have_posts()) :
$query->the_post(); ?>
<div class=\"post\" id=\"post-<?PHP the_ID(); ?>\">
<h2 class=\"title\"><a href=\"<?PHP the_permalink() ?>\" rel=\"bookmark\" title=\"Permanent Link to <?PHP
the_title_attribute(); ?>\"><?PHP
the_title(); ?></a></h2>
<span class=\"top-post-Meta\"><small>Posted on
<?PHP the_time(\'F j,Y\') ?> by <?PHP
the_author() ?></small></span>
<div class=\"cover\">
<div class=\"entry\">
<?PHP ?><div style=\"margin-left:10px;\"class=\"image-frame page-image-frame fr\"><?PHP //echo wp_get_post_image();?></div><?PHP
?><?PHP get_post_excerpt(500) ?>
</div>
</div>
<div class=\"clear\"></div>
</div>
<?PHP endwhile; ?> </div>
<div id=\"navigation\">
<?PHP
wp_reset_query(); if(function_exists(\'wp_pagenavi\')) {
wp_pagenavi(); } ?> </div>
<?PHP else : ?>
<h2 class=\"center\">Not Found</h2>
<p>Sorry,but there are currently no posts found here.</p>
<?PHP endif; ?>
</div> <?PHP get_sidebar(\'right\');
?> <?PHP get_footer(); ?>
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)