在Wordpress中对存档页面进行分页时出现问题 [英] Trouble with paginating an archive page in wordpress

查看:82
本文介绍了在Wordpress中对存档页面进行分页时出现问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在有效的wordpress中创建存档页面.我试图让档案页面显示列表中的所有帖子,但我不希望列表长100个列表项.因此,我试图找出在一页上大约20到30个列表项之后如何制作第二,第三,第四等页面的方法.

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.

我不介意使用wp-paginate插件,但是我仍然不确定如何使用wp_get_archives()

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

我认为这并不重要,但我会在页面上通过Google自定义搜索找到搜索栏.所以我没有提供它,因为我认为它不会导致实际问题.

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.

任何帮助将不胜感激!

<?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(); ?>

推荐答案

对于分页,我始终使用Eric Martin的emm_paginate函数. http://www.ericmmartin.com/pagination-function-for-wordpress/

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

关于存档页面,为什么不只使用Wordpress的内置存档页面. http://codex.wordpress.org/Creating_an_Archive_Index

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.

这篇关于在Wordpress中对存档页面进行分页时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆