在WordPress后台文章编辑器的上方或下方添加提示内容

WordPress 3.5 新增了一对非常有用的挂钩,可以快速在WordPress后台文章编辑器的上方或下方添加提示内容,下面是一个简单的例子,直接将代码添加到主题的 functions.php 文件:

function below_the_title() {
    echo '<h3>在编辑器上方添加的提示内容</h3>';
}
 
add_action( 'edit_form_after_title', 'below_the_title' );
 
function below_the_editor() {
    echo '<h4>在编辑器下方添加的提示内容</h4>';
}
 
add_action( 'edit_form_after_editor', 'below_the_editor' );

结果如下图所示:

add-a-message-above-or-below-the-post-editor-wpdaxue_com

参考资料:http://www.doitwithwp.com/add-a-message-above-or-below-the-post-editor/

来源:

https://www.wpdaxue.com/add-a-message-above-or-below-the-post-editor.html

微信公众号
手机浏览(小程序)
0
分享到:
没有账号? 忘记密码?