WordPress 分页链接函数 paginate_links

paginate_links 用法

<?php echo paginate_links( $args ); ?>

paginate_links 默认参数

<?php $args = array(
    'base'         => '%_%',
    'format'       => '?page=%#%',
    'total'        => 1,
    'current'      => 0,
    'show_all'     => False,
    'end_size'     => 1,
    'mid_size'     => 2,
    'prev_next'    => True,
    'prev_text'    => __('« Previous'),
    'next_text'    => __('Next »'),
    'type'         => 'plain',
    'add_args'     => False,
    'add_fragment' => '',
    'before_page_number' => '',
    'after_page_number' => ''
); ?>
  • base – 用来参考的网址
  • format – 用于URL的分页结构,例如: /page/3
  • total – 总页数
  • current – 当前页码
  • show_all – 默认值是false,如果设置为true,那么将显示所有的可用页码
  • end_size – 页面显示在列表的末尾号
  • mid_size – 多少个数字到当前页面的两侧,但不包括当前页面
  • prev_next – 布尔值,是否包含上一页和下一页的链接
  • prev_text – 前一页的文字。只有当’prev_next’参数设置为true
  • next_text – 下一页的文字。只有当’prev_next’参数设置为true
  • type – 定义该函数返回什么,plain, array 或 list
  • add_args – 添加查询字符串参数到链接
  • add_fragment – 添加文本追加到每个链接
  • before_page_number – 在页码前显示的字符串
  • after_page_number – 在页码后显示的字符串
posted @ 2022-12-27 10:27  fsl  阅读(136)  评论(0编辑  收藏  举报