2013-05-30 13 views
0

У меня есть сайт wordpress: есть проблема с разбиением на страницы. Когда я нажимаю на 2-ю страницу, он показывает первую (индексную страницу). Другие страницы работают. Вы можете мне помочь? Я искал ошибки в цикле, но ничего не нашел!Wordpress Pagination

это мой index.php код

<?php get_header(); ?> 
    <div id="content"> 
    <?php if(get_option('freshlife_featured_content_enable') == 'on') { ?> 
     <div id="featured-content"> 
      <div class="heading"> 
       <span class="heading-text"><?php _e('Featured Articles', 'themejunkie'); ?></span> 
      </div> <!-- end .heading --> 
      <ul> 
       <?php 
        $counter = 1; 
        query_posts(array(
         'showposts' => get_option('freshlife_featured_post_num'), 
         'tag' => get_option('freshlife_featured_post_tags')   
        ));  
        if(have_posts()) : while(have_posts()) : the_post(); 
       ?> 
        <li class="featured-<?php echo $counter; ?>"><a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_post_thumbnail('featured-thumb', array('class' => 'entry-thumb')); ?></a><span class="entry-date"><abbr title="<?php the_time('F j, Y'); ?> at <?php the_time('g:i a'); ?>"><?php echo human_time_diff(get_the_time('U'), current_time('timestamp')) . __(' ago', 'themejunkie'); ?></abbr></span><h2 class="entry-title"><a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2></li> 
       <?php $counter++; endwhile; endif; wp_reset_query(); ?> 
      </ul> 
     </div> <!-- end #featured-content --> 
    <?php } ?> 
    <div class="heading"> 
     <span class="heading-text"><?php _e('All Stories', 'themejunkie'); ?></span> 
    </div> <!-- end .heading --> 
<?php if (have_posts()) : while (have_posts()) : the_post(); ?> 
     <?php include(TEMPLATEPATH. '/includes/templates/loop.php'); ?> 
    <?php endwhile; ?> 
    <div class="clear"></div> 
    <?php if (function_exists('wp_pagenavi')) wp_pagenavi(); else { ?> 
     <div class="pagination"> 
      <div class="left"><?php previous_posts_link(__('Newer Entries', 'themejunkie')) ?></div> 
      <div class="right"><?php next_posts_link(__('Older Entries', 'themejunkie')) ?></div> 
      <div class="clear"></div> 
     </div> <!-- end .pagination --> 
    <?php } ?> 
    <?php else : ?> 
    <?php endif; ?> 
</div> <!-- end #content --> 
<?php get_sidebar(); ?> 
<?php get_footer(); ?> 

ответ

0

Это трудно сказать, не глядя на WP_Query, порожденного запросами.

Но я вижу что-то, что может вызвать проблемы, query_posts изменяет основной запрос, который может быть беспорядочным с разбиением на страницы.

Попробуйте использовать get_posts вместо query_posts, поэтому основной цикл не будет затронут.

Более подробное описание можно найти here

+0

Спасибо годов. Теперь это работает! –