admin管理员组文章数量:1130349
I'm looking for adding a custom css in the admin panel by targeting user id cause I have another administrator but I want to hide something from him by css. I'm using this code to put some stylesheet files in the admin panel, but its for all users
add_action('admin_head', 'my_custom_fonts');
function my_custom_fonts() {
echo ' <link rel="stylesheet" type="text/css" href="../../admincss.css?v=1.3">';
}
I'm looking for adding a custom css in the admin panel by targeting user id cause I have another administrator but I want to hide something from him by css. I'm using this code to put some stylesheet files in the admin panel, but its for all users
add_action('admin_head', 'my_custom_fonts');
function my_custom_fonts() {
echo ' <link rel="stylesheet" type="text/css" href="../../admincss.css?v=1.3">';
}
Share
Improve this question
asked Nov 23, 2018 at 5:01
Gamal ElwazeeryGamal Elwazeery
259 bronze badges
2 Answers
Reset to default 0Use below code into functions.php file. Make sure you are using it right way use admin_enqueue_scripts
add_action('admin_enqueue_scripts', 'FUNCTION_NAME');function FUNCTION_NAME() {
global $current_user;
$user_id = get_current_user_id();
if(is_admin() && $user_id == '2'){
wp_enqueue_style( 'admin_css', get_template_directory_uri() . '/admin-style.css', false, '1.0.0' );
}}
done it
add_action('admin_head', 'my_custom_fonts');
function my_custom_fonts() {
global $current_user;
$user_id = get_current_user_id();
if(is_admin() && $user_id == '2'){
echo ' <link rel="stylesheet" type="text/css" href="../../new.css">';
}
}
I'm looking for adding a custom css in the admin panel by targeting user id cause I have another administrator but I want to hide something from him by css. I'm using this code to put some stylesheet files in the admin panel, but its for all users
add_action('admin_head', 'my_custom_fonts');
function my_custom_fonts() {
echo ' <link rel="stylesheet" type="text/css" href="../../admincss.css?v=1.3">';
}
I'm looking for adding a custom css in the admin panel by targeting user id cause I have another administrator but I want to hide something from him by css. I'm using this code to put some stylesheet files in the admin panel, but its for all users
add_action('admin_head', 'my_custom_fonts');
function my_custom_fonts() {
echo ' <link rel="stylesheet" type="text/css" href="../../admincss.css?v=1.3">';
}
Share
Improve this question
asked Nov 23, 2018 at 5:01
Gamal ElwazeeryGamal Elwazeery
259 bronze badges
2 Answers
Reset to default 0Use below code into functions.php file. Make sure you are using it right way use admin_enqueue_scripts
add_action('admin_enqueue_scripts', 'FUNCTION_NAME');function FUNCTION_NAME() {
global $current_user;
$user_id = get_current_user_id();
if(is_admin() && $user_id == '2'){
wp_enqueue_style( 'admin_css', get_template_directory_uri() . '/admin-style.css', false, '1.0.0' );
}}
done it
add_action('admin_head', 'my_custom_fonts');
function my_custom_fonts() {
global $current_user;
$user_id = get_current_user_id();
if(is_admin() && $user_id == '2'){
echo ' <link rel="stylesheet" type="text/css" href="../../new.css">';
}
}
本文标签: custom css in admin panel by user id
版权声明:本文标题:custom css in admin panel by user id 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://it.en369.cn/questions/1749157688a2324871.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。


发表评论