• I’ve created my own admin panel for the theme I’m developing, now I want to style it up but I’m not able to load the CSS file into the admin panel. I’ve done it the same way how the Codex showcases it.

    This is the code in functions.php

    function chase_admin_panel_init () {
    wp_register_style ('admin_panel_css', TEMPLATEPATH . '/admin_panel_css.css');
    }
    
    add_action ('admin_init', 'chase_admin_panel_init');
    
    function chase_admin_panel_style () {
    wp_enqueue_style ('admin_panel_css');
    }
    chase_admin_panel_style ();
    require_once (TEMPLATEPATH . '/blurb_panel.php');

    I register the CSS file (the path is correct I’ve already checked it), then I do the add_action, and then I create the function for enqueue_style, and THEN I call the function right BEFORE blurb_panel.php which contains the admin panel.

    Though, when I look in the admin panel, no changes take affect at all.

    Any ideas what I’m doing wrong?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter chaseman

    (@chaseman)

    This does NOT work either:

    function chase_admin_panel_stylesheet () {
    wp_register_style ('admin_panel_css', TEMPLATEPATH . '/admin_panel_css.css');
    wp_enqueue_style ('admin_panel_css');
    }
    
    add_action ('admin_print_styles', 'chase_admin_panel_stylesheet');
    
    require_once (TEMPLATEPATH . '/blurb_panel.php');
    Thread Starter chaseman

    (@chaseman)

    Ok I have to correct myself, the path was NOT correct, I was using a path which is meant for local files only and not for a web friendly path, this one will work:

    function chase_admin_panel_stylesheet () {
    wp_enqueue_style ('admin_panel_css', get_stylesheet_directory_uri() . '/admin_panel_css.css');
    }

    SOLVED!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Not Able to Load CSS File Into Admin Panel’ is closed to new replies.