Plugin CSS i WordPress

Efter en række eksperimenter har jeg fundet denne opskrift, der hooker et stylesheet rigtigt ind i WP dashboard. Virker både for admin og øvrige registrerede brugere:

add_action( 'admin_enqueue_scripts', 'safely_add_stylesheet_to_admin' );
    /**
     * Add stylesheet to the page
     */
    function safely_add_stylesheet_to_admin() {
        wp_enqueue_style( 'prefix-style', plugins_url('style_admin.css', __FILE__) );
    }

Published by

Per Thykjaer Jensen

I am a Senior Lecturer in front- and backend web programming at the Multimedia Design and Communication Programme at Business Academy Aaarhus.

I speak several languages: PHP, Python, MySQL, JavaScript, Nodejs, HTML, CSS, and … Danish.

Background: MA it, interaction and multimedia – MA Literature history – BA Art History.