WordPress编辑器添加文章分页按钮

WordPress评论360阅读模式

不知道为什么Wordpress明明有文章分页功能,而编辑器却没有插入分页符的按钮,必须切换到文本模式输入<!--nextpage-->才能插入分页。可以通过下面的代码在编辑器上添加一个分页符按钮。

将下面的代码添加到当前主题functions.php即可。

	function mce_page_break($mce_buttons) {
		$pos = array_search('wp_more', $mce_buttons, true);
		if ($pos !== false) {
			$buttons = array_slice($mce_buttons, 0, $pos + 1);
			$buttons[] = 'wp_page';
			$mce_buttons = array_merge($buttons, array_slice($mce_buttons, $pos + 1));
			}
		return $mce_buttons;
	}

	add_filter('mce_buttons', 'mce_page_break');

本站文章大部分始于原创,用于个人学习记录,可能对您有所帮助,仅供参考!

weinxin
我的微信
版权声明
本站原创文章转载请注明文章出处及链接,谢谢合作!
 
知更鸟
匿名

发表评论

匿名网友
:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

拖动滑块以完成验证