如何为wordpress 的文章添加分页

原文参考:http://www.wpdaxue.com/add-next-page-button-wordpress-post-editor.html

1、在编辑文章时切到text 模式,然后加上<!--nextpage-->

2、每次都要手动添加分页代码 <!--nextpage-->是一件非常费力的事,其实,我们只要在当前主题的 functions.php 添加下面的代码,就可以显示“下一页”按钮啦:

如果你是 WP 4.2 或以上的版本,可以使用下面的代码:

flymood: function.php 在 wp-content/themes/thwentythirteen(你的主题) 下面

  1. /*-----------------------------------------------------------------------------------*/
  2. # 在 WordPress 编辑器添加“下一页”按钮
  3. # http://www.wpdaxue.com/add-next-page-button-wordpress-post-editor.html
  4. /*-----------------------------------------------------------------------------------*/
  5. add_filter( 'mce_buttons', 'cmp_add_page_break_button', 1, 2 );
  6. function cmp_add_page_break_button( $buttons, $id ){
  7.     if ( 'content' != $id )
  8.         return $buttons;
  9.     array_splice( $buttons, 13, 0, 'wp_page' );
  10.     return $buttons;
  11. }

效果如下:

2015-09-05_105422_wpdaxue_com

原文地址:https://www.cnblogs.com/flymood/p/4870278.html