![]() Don’t forget to change the script and style handle name and path to the file. This hook will be the same for both scripts and style.Īdd this code to functions.php file to add scripts and styles in WordPress admin for all pages. To enqueue any scripts and styles in admin, WordPress provides a hook admin_enequeue_scripts. Enqueue Scripts & Style in WordPress Admin for All Pages You can add those code snippets into your theme’s functions.php file with their respective parameters. To enqueue scripts and styles in WordPress admin pages and login pages, code snippets are given below. That's it! Hopefully this helps prevent WordPress newbies from statically rendering their external CSS and JS files directly in template files.Are you working with custom theme or plugin?, then there can be a chance where you need to enqueue scripts and styles in WordPress admin pages or any specific admin page or may be login page. '/js/bxslider.js', array('jquery'), '1.0.0', true ) Īdd_action( 'wp_enqueue_scripts', 'custom_enqueue_scripts') Wp_enqueue_script( 'bxslider', get_template_directory_uri(). Now that we have the custom stylesheet and script ready to be loaded into our custom WordPress theme, we just need to properly package them together as a function in our functions.php file: // Add styles and scripts to the header/footer
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |