【发布时间】:2015-04-13 16:40:44
【问题描述】:
突然我的分页停止工作。我试过关闭所有插件,没有用。检查函数文件,没什么奇怪的。我不知道是什么导致了这个问题。对此有什么想法吗?我如何使这个分页再次工作。我使用 WP-PageNavi,但标准导航代码也会发生同样的事情。
我的代码:
<?php
if( is_front_page() ){
$paged = (get_query_var('page')) ? get_query_var('page') : 1;
} else {
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
}
query_posts('posts_per_page='.get_option('posts_per_page').'&paged=' . $paged);
?>
<div id="homepage-blog" class="clr">
<h2 class="heading">Title</h2>
<?php $wpex_count=0; ?>
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<?php $wpex_count++; ?>
<article class="recent-blog-entry clr col span_1_of_3 col-<?php echo $wpex_count; ?>">
<?php
// Display post thumbnail
if ( has_post_thumbnail() ) { ?>
<div class="recent-blog-entry-thumbnail">
<a href="<?php the_permalink(); ?>" title="<?php echo esc_attr( the_title_attribute( 'echo=0' ) ); ?>">
<img src="<?php echo wpex_get_featured_img_url(); ?>" alt="<?php echo esc_attr( the_title_attribute( 'echo=0' ) ); ?>" />
</a>
</div><!-- .recent-blog-entry-thumbnail -->
<?php } ?>
<header>
<h3 class="recent-blog-entry-title"><a href="<?php the_permalink(); ?>" title="<?php echo esc_attr( the_title_attribute( 'echo=0' ) ); ?>"><?php the_title(); ?></a></h3>
<ul class="post-meta clr">
<li class="meta-date"><span class="meta-date-text"><?php echo get_the_date(); ?></span> </li>
</ul>
</header>
<div class="recent-blog-entry-content entry clr">
<?php wpex_excerpt( 18, false ); ?>
</div>
</article>
<?php if ( $wpex_count == '3' ) { ?>
<?php $wpex_count=0; ?>
<?php } ?>
<?php endwhile; ?>
<?php wp_pagenavi();?>
</div>
<?php wp_reset_query(); ?>
<?php endif; ?>
</article>
<?php endwhile; ?>
【问题讨论】:
标签: php wordpress navigation