> 转载 > WordPress 编辑器添加“下一页”分页按钮

WordPress 编辑器添加“下一页”分页按钮

  不少朋友总喜欢给长一点的文章进行分页,但是默认情况下,在WordPress的编辑器中,是没有显示“下一页”按钮的,每次都要手动添加分页代码 <!--nextpage-->是一件非常费力的事,其实,我们只要在当前主题的functions.php 添加下面的代码,就可以显示“下一页”按钮啦:

  1. //在 WordPress 编辑器添加“下一页”按钮
  2. add_filter('mce_buttons','wpdaxue_add_next_page_button');
  3. function wpdaxue_add_next_page_button($mce_buttons) {
  4. $pos = array_search('wp_more',$mce_buttons,true);
  5. if ($pos !== false) {
  6. $tmp_buttons = array_slice($mce_buttons, 0, $pos+1);
  7. $tmp_buttons[] = 'wp_page';
  8. $mce_buttons = array_merge($tmp_buttons, array_slice($mce_buttons, $pos+1));
  9. }
  10. return $mce_buttons;
  11. }
原文:http://www.wpdaxue.com/add-next-page-button-wordpress-post-editor.html

典型的夜猫子,失眠者。爱好LOL、徒步、旅行、拍照、音乐、小球。E-mail:[email protected]

WordPress 编辑器添加“下一页”分页按钮:等您坐沙发呢!

发表评论

表情
还能输入210个字

了解 李英杰害虫 的更多信息

立即订阅以继续阅读并访问完整档案。

Continue reading