[wp-hackers] requesting information about wp_*_style functions

Krusty Ruffle krustyruffle at rustykruffle.com
Thu Oct 30 02:07:20 GMT 2008

I want to be able to write a file called tweaks.css, place it any theme's
directory and use it to tweak styles for plugins that don't match the theme
very well, or for minor theme tweaks to the theme itself. To be able to
overwrite the styles that are loaded by other things I need it to be linked
last in the pages head.

This is the code that I've come up with for this. It seems to work, but I
feel like this is not quite right. Could somebody let me know if I've done
this right and maybe send me a link or explain the proper way to do this?

Thanks in advance for any help with this, it is greatly appreciated. :)

// Include a link to tweaks.css if it exists in the current templates
function krusty_plugstyles(){
    if(file_exists(get_template_directory()) . '/tweaks.css'){
        wp_register_style('krusted-plugstyles', get_bloginfo('template_url')
. '/tweaks.css', array(), '', 'screen');

// add an action when wordpress loads a pages 'head', use '100' in hopes
that this will be the last thing to run.
add_action('wp_head', 'krusty_plugstyles', '100');

More information about the wp-hackers mailing list