分页在作者和类别档案中无法正常工作

时间:2011-01-25 15:00:22

标签: php wordpress wordpress-plugin wordpress-theming

我已经制作了一个在其底部有分页的类别页面。每次我尝试转到第2页时,URL结构都会发生变化,但我的循环中的帖子却没有。对于具有几乎完全相同的循环的博客页面,分页工作正常。对我可能做错的任何暗示?我也在使用Wp-Paginate插件。

<ul class="blogpostings">
    <?php if (have_posts()) : ?>

        <?php while (have_posts()) : the_post();?> 
            <li>
            <?php if ( has_post_thumbnail() ):?>
                <?php
                $image_id = get_post_thumbnail_id();
                $image_url = wp_get_attachment_image_src($image_id, 'thumbnail', true);
                echo '<a href="' . get_permalink($post->ID) . '" title="' . get_the_title($post->ID) . '"><img src="' . $image_url[0] . '" title="' . get_the_title($post->ID) . '" alt="' . get_the_title($post->ID) . '" /></a>';
                ?>
            <?php endif; ?>
                <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2><br/>
                <h3><?php the_author_posts_link(); ?>  <span class="date">| <?php the_time('F d, Y') ?> |</span>  <?php comments_popup_link('Post Comment', '1 Comment &#187;', '% Comments &#187;'); ?> 
                <fb:like href="<?php the_permalink() ?>" layout="button_count" width="100" font="lucida grande"></fb:like>
                </h3>
                    <?php the_excerpt(); ?>
                    <p class="postreadmore"><a href="<?php the_permalink() ?>" class="arrow"> Read More </a></p>
            </li>
        <?php endwhile; ?>
            </ul>
        <?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); } else { ?>

            <?php if(function_exists('wp_paginate')) {
                wp_paginate();
            } ?>

        <?php } ?>
        <?php endif; ?>
        </div>

1 个答案:

答案 0 :(得分:0)

如果您使用的是query_posts(),请确保包含paged参数。以下内容应该有所帮助:http://ivanasetiawan.com/wp-pagination-stays-on-the-same-page/

相关问题