/** * Registers stylesheets for the framework. This function merely registers styles with WordPress using * the wp_register_style() function. It does not load any stylesheets on the site. If a theme wants to * register its own custom styles, it should do so on the 'wp_enqueue_scripts' hook. * * @since 1.5.0 * @access private * @return void */ function hybrid_register_styles() { /* Get framework styles. */ $styles = hybrid_get_styles(); /* Use the .min stylesheet if SCRIPT_DEBUG is turned off. */ $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min'; /* Loop through each style and register it. */ foreach ($styles as $style => $args) { $defaults = array('handle' => $style, 'src' => trailingslashit(HYBRID_CSS) . "{$style}{$suffix}.css", 'deps' => null, 'version' => false, 'media' => 'all'); $args = wp_parse_args($args, $defaults); wp_register_style(sanitize_key($args['handle']), esc_url($args['src']), is_array($args['deps']) ? $args['deps'] : null, preg_replace('/[^a-z0-9_\\-.]/', '', strtolower($args['version'])), esc_attr($args['media'])); } }
/** * Tells WordPress to load the styles needed for the framework using the wp_enqueue_style() function. * * @since 1.5.0 * @access private * @return void */ function hybrid_enqueue_styles() { /* Get the theme-supported stylesheets. */ $supports = get_theme_support('hybrid-core-styles'); /* If the theme doesn't add support for any styles, return. */ if (!is_array($supports[0])) { return; } /* Get framework styles. */ $styles = hybrid_get_styles(); /* Loop through each of the core framework styles and enqueue them if supported. */ foreach ($supports[0] as $style) { if (isset($styles[$style])) { wp_enqueue_style($style); } } }