01月27, 2018

WordPress 实现分页

wordpress有一个不好的地方,没有原生支持日志分页,而是用上一页、下一页这种一页页的翻页,日志少还没什么,但如果你有个百八十页,那就翻吧。

Source #Source

File: wp-includes/link-template.php

function get_the_posts_navigation( $args = array() ) { $navigation = '';

  • // Don't print empty markup if there's only one page.
  • if ( $GLOBALS['wp_query']->max_num_pages > 1 ) {
  • $args = wp_parse_args( $args, array(
  • 'prev_text' => __( 'Older posts' ),
  • 'next_text' => __( 'Newer posts' ),
  • 'screen_reader_text' => __( 'Posts navigation' ),
  • ) );
php

参考:

http://www.ssdax.com/615.html

本文链接:https://www.daguanren.cc/post/wordpress_pagination.html

-- EOF --

Comments