wordpress修改只能看到自己文章和评论

//作者后台只看自己文章
function mypo_parse_query_useronly( $wp_query ) {
if ( strpos( $_SERVER[ ‘REQUEST_URI’ ], ‘/wp-admin/edit.php’ ) !== false ) {
if ( !current_user_can( ‘level_10’ ) ) {
global $current_user;
$wp_query->set( ‘author’, $current_user->id );
}
}
}
add_filter(‘parse_query’, ‘mypo_parse_query_useronly’ );

/**
* 让作者在 WordPress 后台只能看到自己文章下的评论

*/
function wpdx_get_comment_list_by_user($clauses) {
if (is_admin()) {
global $user_ID, $wpdb;
$clauses[‘join’] = “, wp_posts”;
$clauses[‘where’] .= ” AND wp_posts.post_author = “.$user_ID.” AND wp_comments.comment_post_ID = wp_posts.ID”;
};
return $clauses;
};
if(!current_user_can(‘edit_others_posts’)) {
add_filter(‘comments_clauses’, ‘wpdx_get_comment_list_by_user’);
}

wordpress修改管理后台左上角logo及下方备注

//移除左上角Wlog
function annointed_admin_bar_remove() {
global $wp_admin_bar;
/* Remove their stuff */
$wp_admin_bar->remove_menu(‘wp-logo’);
}
add_action(‘wp_before_admin_bar_render’, ‘annointed_admin_bar_remove’, 0);
//移除Wordpress后台“感谢使用wordpress创作”
function my_admin_footer_text(){
return “”;
}
function my_update_footer()
{
return “”;
}
add_filter( ‘admin_footer_text’, ‘my_admin_footer_text’, 10 );
add_filter( ‘update_footer’, ‘my_update_footer’, 50 );

wordpress修改登录页面logo图标

function custom_loginlogo() {
echo ‘<style type=”text/css”>
h1 a {background-image: url(‘.get_bloginfo(‘template_directory’).’/images/login_logo.png) !important; }
</style>’;
}
add_action(‘login_head’, ‘custom_loginlogo’);

接下来我们还城朵打开wp-login.php文件,找到【$login_header_url= __( ‘http://wordpress.org/’)】,把里面的链接修改为你自己的,比如改为首页的。

wordpress 数据库设置某分类所有文章密码保护

UPDATE wp_posts, wp_term_relationships, wp_term_taxonomy
SET wp_posts.post_password = ‘123456’
WHERE
wp_posts.ID = wp_term_relationships.object_id
AND
wp_term_taxonomy.taxonomy = ‘category’
AND
wp_term_taxonomy.term_taxonomy_id = wp_term_relationships.term_taxonomy_id
AND
wp_posts.post_status = ‘publish’
AND
wp_posts.post_type = ‘post’
AND
wp_term_taxonomy.term_id = ‘5’;

//123456为新设置的密码,id=5是文章分类的id

wordpress修改登录界面的背景图片

function custom_login_head(){
$str=file_get_contents(‘http://cn.bing.com/HPImageArchive.aspx?format=js&idx=0&n=1′);
if (preg_match(“/\/(.+?).jpg/”, $str, $matches)) {
$imgurl=’http://s.cn.bing.net’.$matches[0];
}
echo'<style type=”text/css”>body{background: url(‘.$imgurl.’);background-image:url(‘.$imgurl.’);-moz-border-image: url(‘.$imgurl.’);}</style>’;
}
add_action(‘login_head’, ‘custom_login_head’);
#直接复制代码即可,此代码是调用bing每日壁纸
#每日都会自动更新,都是精选美图很不错的