Answers for "add admin style sheet wordpress"

1

admin css wordpress add

<?php
      //from functions.php

      //First solution : one file
      //If you're using a child theme you could use:
      // get_stylesheet_directory_uri() instead of get_template_directory_uri()
      add_action( 'admin_enqueue_scripts', 'load_admin_style' );
      function load_admin_style() {
        wp_register_style( 'admin_css', get_template_directory_uri() . '/admin-style.css', false, '1.0.0' );
//OR
        wp_enqueue_style( 'admin_css', get_template_directory_uri() . '/admin-style.css', false, '1.0.0' );
       }

      //Second solution : two or more files.
      //If you're using a child theme you could use:
      // get_stylesheet_directory_uri() instead of get_template_directory_uri()
      add_action( 'admin_enqueue_scripts', 'load_admin_styles' );
      function load_admin_styles() {
        wp_enqueue_style( 'admin_css_foo', get_template_directory_uri() . '/admin-style-foo.css', false, '1.0.0' );
        wp_enqueue_style( 'admin_css_bar', get_template_directory_uri() . '/admin-style-bar.css', false, '1.0.0' );
      }  

    ?>
Posted by: Guest on April-10-2021
0

add admin style sheet wordpress

add_action( 'admin_enqueue_scripts', 'admin_enqueue_scripts_callable' );
function admin_enqueue_scripts_callable(){
	wp_enqueue_style('backend-css', get_stylesheet_directory_uri().'/css/admin.css');
	wp_enqueue_script('backend-js', get_stylesheet_directory_uri().'/js/admin.js');
}
Posted by: Guest on July-08-2021

Browse Popular Code Answers by Language