Created
January 17, 2013 05:12
-
-
Save simplethemes/4553826 to your computer and use it in GitHub Desktop.
minify WordPress theme styles.
This file contains 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
/*-----------------------------------------------------------------------------------*/ | |
// Register and Minify Core Stylesheets | |
/*-----------------------------------------------------------------------------------*/ | |
function st_registerstyles() { | |
// minify folder name (must be in your wp root). | |
$minpath = '/min'; | |
// define directories | |
$child_theme = str_replace(site_url().'/wp-content/themes/', '', get_bloginfo('stylesheet_directory')); | |
$parent_theme = str_replace(site_url().'/wp-content/themes/', '', get_bloginfo('template_directory')); | |
$preset_style = of_get_option('layout_style'); | |
$minify = array( | |
$parent_theme.'/css/skeleton-r.css', | |
$parent_theme.'/css/formalize.css', | |
$parent_theme.'/css/flexslider.css', | |
$parent_theme.'/superfish.css', | |
$parent_theme.'/layout.css', | |
// minify breaks when using @import so we use the parent theme version. | |
// to use the child theme version, copy the styles (only the styles) into child-theme/style.css | |
// make sure to leave the child theme style.css header in tact. | |
$parent_theme.'/style.css', | |
$child_theme.'/'.$preset_style.'.css' | |
); | |
$stylesheets = join( ',', $minify ); | |
wp_enqueue_style('theme-styles', $wpsite.$minpath.'/b=wp-content/themes&f='.$stylesheets, NULL, NULL, NULL, 'screen, projection'); | |
} | |
add_action('get_header', 'st_registerstyles'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment