Created
March 12, 2011 13:31
-
-
Save roelven/867234 to your computer and use it in GitHub Desktop.
Load a stylesheet in a Wordpress template in a nice way
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use this snippet to load a stylesheet in the Wordpress way, accessible to other plugins: | |
// Credit http://www.nkuttler.de/post/wordpress-style-version-conditional-comments/ | |
if (!is_admin()) { | |
$theme = get_theme(get_current_theme()); | |
wp_register_style($theme['Template'], get_bloginfo('stylesheet_url'), false, $theme['Version']); | |
wp_enqueue_style($theme['Template']); | |
} | |
// This will look like this: | |
// <link rel='stylesheet' id='[TEMPLATENAME]-css' href='http://[YOURDOMAIN]/wp-content/themes/[YOURTHEME]/style.css?ver=0.1' type='text/css' media='all' /> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment