分页不工作(使用wp-paginate)我使用wordpress

时间:2015-05-22 09:59:14

标签: pagination

这是我的代码,我在wordpress中使用wp-paginate插件。我尝试过很多东西,比如替换twentyfourteen_paging_nav();与

if(function_exists('wp_paginate')) {
    wp_paginate();
}
else {
    twentyfourteen_paging_nav();
} 

在archieve.php中,但仍无效。

    <ul class="blog-list">
                    <?php
                    $blog = array(
     'category'  => '8',     // post_id of category
     'order' => 'Asc',
     'posts_per_page' => 4,
      'paged' => $paged
    );
    $blog_post = get_posts( $blog );
    foreach ($blog_post as $post) : setup_postdata( $post );
     $blog_img = $post->ID;
     $blog_title = $post->post_title;
     $blog_para = $post->post_content;

 $blog_trimed=wp_trim_words($blog_para, 45);
 $blog_name = get_post_meta($post->ID, 'author name', true);

?>
                    <li>
                        <div class="blog-content-left">
                           <?php echo get_the_post_thumbnail($blog_img, array(420,250)); ?>
                        </div>
                        <div class="blog-content-right">
                            <a href="<?php echo get_permalink(); ?>" class="blog-title"><?php echo $blog_title; ?></a>
                            <p class="blog-date-area"><span class="blog-date"><?php echo get_the_date('M d, Y'); ?></span><span class="blog-date blog-crcl"><?php echo $blog_name; ?></span></p>
                            <div class="blog-para">
                                <p><?php echo $blog_trimed;  ?></p>
                            </div>
                            <span class="read-more-btn-blue">
                                <a href="<?php echo get_permalink(); ?>">Read More</a>
                            </span>
                    </div>
                </li>
                <?php endforeach;?>

            </ul>
           <?php echo wp_paginate(); ?>

提前感谢您的帮助。

1 个答案:

答案 0 :(得分:0)

没有找到任何解决方案所以我使用了pagednavi而不是..