I want to fully customize the wp-admin interface. I'm creating some plugins to remove the default menu pages and to add my custom pages, and seems working fine.Anyway I need to implement bootstrap 5 and bootstrap icons for the menù pages since I will use it to create the layout of each menu related page, is there a correct way to achive this? Is also possible with some hook or css to modify the default color of wp left menù?
1 Answer
Basically, to add admin-style.css
to admin:
function wpdocs_enqueue_custom_admin_style() {
wp_register_style( 'custom_wp_admin_css', get_template_directory_uri() . '/admin-style.css', false, '1.0.0' );
wp_enqueue_style( 'custom_wp_admin_css' );
}
add_action( 'admin_enqueue_scripts', 'wpdocs_enqueue_custom_admin_style' );
Do approximately the same for Javascript. See https://developer.wordpress.org/reference/hooks/admin_enqueue_scripts/
And see https://wordpress.stackexchange.com/search?q=custom+css+admin
-
What if I want to load the scripts from cdn? I've tried like suggested but seems not working– OHICTCommented Sep 6, 2023 at 13:54
-
Put your CDN URL as the second argument to wp_register_style(), in place of get_template_directory_uri()... etc. I'd also omit the version argument if that's already embedded in the URL somewhere - it will be added as a query string that your CDN won't do anything with.– RupCommented Sep 6, 2023 at 15:44
-
Search this site. wordpress.stackexchange.com/questions/216890/… Commented Sep 6, 2023 at 15:44