您的位置:首页 > 其它

WordPress发布文章时选择作者

2016-11-23 19:09 323 查看
对于多作者用户,在发布文章时提供作者选项非常实用。在主题目录的
function.php
中添加以下代码即可。

#代码来源:http://www.ludou.org/move-author-metabox-publish-metabox-wordpress.html

add_action( 'admin_menu', 'remove_author_metabox' );
add_action( 'post_submitbox_misc_actions', 'move_author_to_publish_metabox' );
function remove_author_metabox() {
remove_meta_box( 'authordiv', 'post', 'normal' );
}
function move_author_to_publish_metabox() {
global $post_ID;
$post = get_post( $post_ID );
echo '<div id="author" class="misc-pub-section" style="border-top-style:solid; border-top-width:1px; border-top-color:#EEEEEE; border-bottom-width:0px;">作者: ';
post_author_meta_box( $post );
echo '</div>';
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  wordpress