为WordPress编辑器添加分页按钮
来源:wordpress
作者:
2020-05-31
wordpress正文具备分页功能,但在编辑器中却没有添加分页的按钮,我们可以通过下面的一段代码很容易添加一个分页按钮。
将以下代码添加到您的当前主题的 functions.php 文件:
1 2 3 4 5 6 7 8 9 10 11 | add_filter( 'mce_buttons' , 'wysiwyg_editor' ); function wysiwyg_editor( $mce_buttons ) { $pos = array_search ( 'wp_more' , $mce_buttons ,true); if ( $pos !== false) { $tmp_buttons = array_slice ( $mce_buttons , 0, $pos +1); $tmp_buttons [] = 'wp_page' ; $mce_buttons = array_merge ( $tmp_buttons , array_slice ( $mce_buttons , $pos +1)); } return $mce_buttons ; |