Trouble with paginating an archive page in wordpre

2019-07-08 14:51发布

Im trying to make an archive page in wordpress that works. Im trying to have the archive page show all posts in a list, but i dont want a list that is 100 list items long. So im trying to figure out how to get it to make a second, third, fourth, etc... page after about 20 to 30 list items on one page.

I dont mind using the wp-paginate plug in, but im still not sure how to get that to work with wp_get_archives()

I dont think it matters, but i will have a search bar on the page and its through google custom search. So i didnt supply it, as i dont think it contributes to the actual issue.

Any help would be greatly appreciated!

<?php
/*
Template Name: Archives
*/
get_header(); ?>
<div id="main">
    <div id="posts">
        <?php the_post(); ?>
        <h1 class="entry-title"><?php the_title(); ?></h1>

        <ul>
             <?php wp_get_archives( 'type=postbypost' ); ?>
        </ul>

        <?php wp_link_pages(); ?>

        <?php rewind_posts(); ?>
    </div>
</div>

<?php get_sidebar(); ?>
<?php get_footer(); ?>

1条回答
干净又极端
2楼-- · 2019-07-08 15:38

For pagination, I always use Eric Martin's emm_paginate function. http://www.ericmmartin.com/pagination-function-for-wordpress/

In regards to your archive page, why not just use Wordpress's built in Archive page. http://codex.wordpress.org/Creating_an_Archive_Index

With those two links, you should be able to build an Archive page that has the pagination you desire.

查看更多
登录 后发表回答