/** * Load stylesheets for the front end. * * @since 1.0 * @access public * @return void */ function hoot_base_enqueue_styles() { /* Gets ".min" suffix. */ $suffix = hoot_get_min_suffix(); /* Load Google Fonts if 'google-fonts' is active. */ if (current_theme_supports('google-fonts')) { wp_enqueue_style('hoot-google-fonts', hoot_google_fonts_enqueue_url(), array(), null); } /* Load lightSlider style if 'light-slider' is active. */ if (current_theme_supports('slick-slider')) { wp_enqueue_style('slick', trailingslashit(THEME_URI) . "css/slick{$suffix}.css", false, '1.5.9'); wp_enqueue_style('slick-theme', trailingslashit(THEME_URI) . "css/slick-theme{$suffix}.css", false, '1.5.9'); } /* Load gallery style if 'cleaner-gallery' is active. */ if (current_theme_supports('cleaner-gallery')) { wp_enqueue_style('gallery', trailingslashit(HOOT_CSS) . "gallery{$suffix}.css"); } /* Load gallery styles if Jetpack 'tiled-gallery' module is active */ if (class_exists('Jetpack') && Jetpack::is_module_active('tiled-gallery')) { wp_enqueue_style('gallery', trailingslashit(HOOT_CSS) . "gallery{$suffix}.css"); wp_enqueue_style('hoot-jetpack', trailingslashit(THEME_URI) . "css/jetpack{$suffix}.css"); } /* Load font awesome if 'font-awesome' is active. */ if (current_theme_supports('font-awesome')) { wp_enqueue_style('font-awesome', trailingslashit(HOOT_CSS) . "font-awesome{$suffix}.css", false, '4.2.0'); } }
/** * Registers JavaScript files for the framework. This function merely registers scripts with WordPress using * the wp_register_script() function. It does not load any script files on the site. If a theme wants to register * its own custom scripts, it should do so on the 'wp_enqueue_scripts' hook. * * @since 1.0.0 * @access public * @return void */ function hoot_register_scripts() { /* Supported JavaScript. */ $supports = get_theme_support('hoot-core-scripts'); /* Get the minified suffix */ $suffix = hoot_get_min_suffix(); /* Register the 'mobile-toggle' script if the current theme supports 'mobile-toggle'. */ if (isset($supports[0]) && in_array('mobile-toggle', $supports[0])) { wp_register_script('mobile-toggle', esc_url(trailingslashit(HOOT_JS) . "mobile-toggle{$suffix}.js"), array('jquery'), '20130528', true); } }
function hoot_enqueue_admin_widget_styles_scripts($hook) { /* Load hoot widgets for SiteOrigin Page Builder plugin on Edit screens */ $widgetload = ('post.php' == $hook || 'post-new.php' == $hook) && (defined('SITEORIGIN_PANELS_VERSION') && version_compare(SITEORIGIN_PANELS_VERSION, '2.0') >= 0) ? true : false; if ('widgets.php' == $hook || $widgetload) { /* Get the minified suffix */ $suffix = hoot_get_min_suffix(); /* Enqueue Styles */ wp_enqueue_style('hoot-font-awesome'); wp_enqueue_style('hoot-admin-widgets', trailingslashit(HOOT_CSS) . "admin-widgets{$suffix}.css", array(), HOOT_VERSION); /* Enqueue Scripts */ wp_enqueue_script('hoot-admin-widgets', trailingslashit(HOOT_JS) . "admin-widgets{$suffix}.js", array('jquery'), HOOT_VERSION, true); // Load in footer to maintain script heirarchy } }
/** * Enqueue scripts for file uploader * * @since 1.1.0 */ static function enqueue_admin_options_media_scripts() { if (function_exists('wp_enqueue_media')) { wp_enqueue_media(); } /* Get the minified suffix */ $suffix = hoot_get_min_suffix(); wp_register_script('hoot-options-media-uploader', trailingslashit(HOOTOPTIONS_URI) . "js/media-uploader{$suffix}.js", array('jquery'), Hoot_Options::VERSION); wp_enqueue_script('hoot-options-media-uploader'); wp_localize_script('hoot-options-media-uploader', 'hootoptions_l10n', array('upload' => __('Upload', 'dispatch'), 'remove' => __('Remove', 'dispatch'))); }
/** * Loads the required javascript * * @since 1.1.0 */ static function enqueue_admin_options_scripts() { // Get the minified suffix $suffix = hoot_get_min_suffix(); // Enqueue custom option panel JS wp_enqueue_script('hoot-options-custom', trailingslashit(HOOTOPTIONS_URI) . "js/options-custom{$suffix}.js", array('jquery', 'wp-color-picker', 'hoot-options-media-uploader'), Hoot_Options::VERSION); }
/** * Filters the 'stylesheet_uri' returned by get_stylesheet_uri() to allow theme developers to offer a * minimized version of their main 'style.css' file. It will detect if a 'style.min.css' file is available * and use it if HOOT_DEBUG is disabled. * * @since 1.0.0 * @access public * @param string $stylesheet_uri The URI of the active theme's stylesheet. * @param string $stylesheet_dir_uri The directory URI of the active theme's stylesheet. * @return string $stylesheet_uri */ function hoot_min_stylesheet_uri($stylesheet_uri, $stylesheet_dir_uri) { /* Get the minified suffix */ $suffix = hoot_get_min_suffix(); /* Use the .min stylesheet if available. */ if (!empty($suffix)) { /* Remove the stylesheet directory URI from the file name. */ $stylesheet = str_replace(trailingslashit($stylesheet_dir_uri), '', $stylesheet_uri); /* Change the stylesheet name to 'style.min.css'. */ $stylesheet = str_replace('.css', "{$suffix}.css", $stylesheet); /* If the stylesheet exists in the stylesheet directory, set the stylesheet URI to the dev stylesheet. */ if (file_exists(trailingslashit(get_stylesheet_directory()) . $stylesheet)) { $stylesheet_uri = trailingslashit($stylesheet_dir_uri) . $stylesheet; } } /* Return the theme stylesheet. */ return $stylesheet_uri; }
/** * Registers the framework stylesheet files. The function does not load the stylesheet. * It merely registers it with WordPress. * * @since 1.0.0 * @access public * @return void */ function hoot_admin_register_styles() { /* Get the minified suffix */ $suffix = hoot_get_min_suffix(); wp_register_style('hoot-font-awesome', trailingslashit(HOOT_CSS) . "font-awesome{$suffix}.css", false, '4.2.0'); }