admin管理员组文章数量:1287893
i use woocommerce and woocommerce Product Vendors (/) i want hide elements of admin with css file "my-admin.css" I put css file "my-admin.css" at the root of my child theme wordpress and use this code in functions.php. This does not work?!?
function admin_css() {
$admin_handle = 'admin_css';
$admin_stylesheet = get_template_directory_uri() . 'my-admin.css';
wp_enqueue_style($admin_handle, $admin_stylesheet);
}
add_action('admin_print_styles', 'admin_css', 11);
is this an obselete method? because: when i use this other method in functions.php, it's ok it works add_action('admin_head', 'my_custom_fonts');
function my_custom_fonts() {
echo '<style>
body, td, textarea, input, select {
font-family: "Lucida Grande";
font-size: 12px;
}
</style>';
}
What do you think ? thanks !!! :)
i use woocommerce and woocommerce Product Vendors (https://woocommerce/products/product-vendors/) i want hide elements of admin with css file "my-admin.css" I put css file "my-admin.css" at the root of my child theme wordpress and use this code in functions.php. This does not work?!?
function admin_css() {
$admin_handle = 'admin_css';
$admin_stylesheet = get_template_directory_uri() . 'my-admin.css';
wp_enqueue_style($admin_handle, $admin_stylesheet);
}
add_action('admin_print_styles', 'admin_css', 11);
is this an obselete method? because: when i use this other method in functions.php, it's ok it works add_action('admin_head', 'my_custom_fonts');
function my_custom_fonts() {
echo '<style>
body, td, textarea, input, select {
font-family: "Lucida Grande";
font-size: 12px;
}
</style>';
}
What do you think ? thanks !!! :)
Share Improve this question edited Oct 11, 2021 at 18:04 Calachuka asked Oct 11, 2021 at 17:52 CalachukaCalachuka 53 bronze badges 2 |1 Answer
Reset to default 1It's always better to encapsulate your styles in a separate file, so your first example is closer. That said, the documentation for admin_print_styles says quite clearly:
admin_print_styles should not be used to enqueue styles or scripts on the admin pages. Use admin_enqueue_scripts instead.
本文标签: hide elements of admin with css file
版权声明:本文标题:hide elements of admin with css file 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741276549a2369761.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
Edit
link underneath the tags to modify your question to add more information or updates – Tom J Nowell ♦ Commented Oct 12, 2021 at 9:46