CSS i plugin

Dokumentationen på Codex er ikke lysende klar; men et plugin gør sådan:

/* filters etc. */
add_action('wp_print_styles', 'add_hyperboard_stylesheet');

// (...)

/*Required stylesheets */
function add_hyperboard_stylesheet() {
	$myStyleUrl = WP_PLUGIN_URL . '/hyperboard/styles.css';
	$myStyleFile = WP_PLUGIN_DIR . '/hyperboard/styles.css';

        if ( file_exists($myStyleFile) ) {
            wp_register_style('HyperBoardStyleSheets', $myStyleUrl);
            wp_enqueue_style( 'HyperBoardStyleSheets');
        }
}

Pluginet sætter en krog i wp_print_styles.

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.