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

首页 » 实用教程 » 在 WordPress 编辑器添加“下一页”分页按钮
所属分类:实用教程
发布时间:2015-08-27
浏览次数:4,571 views

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

/**
 * 在 WordPress 编辑器添加“下一页”按钮
 * http://www.wpdaxue.com/add-next-page-button-wordpress-post-editor.html
 */
add_filter('mce_buttons','wpdaxue_add_next_page_button');
function wpdaxue_add_next_page_button($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;
}

 

最终效果如下图所示:

add-next-page-button-wpdaxue_com

相关阅读

WordPress联系表单插件 WPForms

在WordPress建站过程中通常会使用到联系表单,通常使用的都是Contact Form 7,但是对于代码小 […]

WordPress定时发布——让搜索引擎和访客爱上你

预知未来的魅力 新浪微博的皮皮时光机很受欢迎,你是个微博funs,想吸引人气,又不想一次把肚子里的墨水吐干净, […]

WP实现全站HTTPS插件:Really Simple SSL

现在非常流行https,很多的网站都实现了全站https,https是不允许有混合内容(http类的资源)存在 […]