/** * 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.2.0 * @access public * @return void */ function hybrid_register_scripts() { /* Supported JavaScript. */ $supports = get_theme_support('hybrid-core-scripts'); /* Get the minified suffix. */ $suffix = hybrid_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(HYBRID_JS) . "mobile-toggle{$suffix}.js"), array('jquery'), '20130528', true); } }
/** * Load stylesheets for the front end. * * @since 1.0.0 * @access public * @return void */ function hybrid_base_enqueue_styles() { /* Gets '.min' suffix. */ $suffix = hybrid_get_min_suffix(); /* Load font-awesome stylsheet. */ wp_enqueue_style('font-awesome', trailingslashit(get_template_directory_uri()) . 'css/font-awesome.min.css'); /* Load gallery style if 'cleaner-gallery' is active. */ if (current_theme_supports('cleaner-gallery')) { wp_enqueue_style('gallery', trailingslashit(HYBRID_CSS) . 'gallery{$suffix}.css'); } /* Load active theme stylesheet. */ wp_enqueue_style('style', get_stylesheet_uri()); /* Load style for IE. */ wp_enqueue_style('hybrid-base-ie', trailingslashit(get_template_directory_uri()) . 'css/ie.css'); wp_style_add_data('hybrid-base-ie', 'conditional', 'lt IE 9'); }
/** * Load stylesheets for the front end. * * @since 1.0.0 * @access public * @return void */ function hybrid_base_enqueue_styles() { /* Gets ".min" suffix. */ $suffix = hybrid_get_min_suffix(); /* Load one-five base style. */ wp_enqueue_style('one-five', trailingslashit(HYBRID_CSS) . "one-five{$suffix}.css"); /* Load gallery style if 'cleaner-gallery' is active. */ if (current_theme_supports('cleaner-gallery')) { wp_enqueue_style('gallery', trailingslashit(HYBRID_CSS) . "gallery{$suffix}.css"); } /* Load parent theme stylesheet if child theme is active. */ if (is_child_theme()) { wp_enqueue_style('parent', trailingslashit(get_template_directory_uri()) . "style{$suffix}.css"); } /* Load active theme stylesheet. */ wp_enqueue_style('style', get_stylesheet_uri()); }
/** * Filters the '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 SCRIPT_DEBUG * is disabled. * * @since 1.5.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 hybrid_min_stylesheet_uri($stylesheet_uri, $stylesheet_dir_uri) { // Get the minified suffix. $suffix = hybrid_get_min_suffix(); // Use the .min stylesheet if available. if ($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(HYBRID_CHILD . $stylesheet)) { $stylesheet_uri = esc_url(trailingslashit($stylesheet_dir_uri) . $stylesheet); } } // Return the theme stylesheet. return $stylesheet_uri; }
/** * Registers stylesheets for use in the admin. * * @since 1.0.0 * @access public * @return void */ function saga_admin_register_styles() { $suffix = hybrid_get_min_suffix(); wp_register_style('font-awesome', trailingslashit(get_template_directory_uri()) . "css/font-awesome{$suffix}.css"); wp_register_style('saga-fonts', '//fonts.googleapis.com/css?family=Droid+Serif:400,700,400italic,700italic|Open+Sans:300,400,600,700'); wp_register_style('saga-admin-custom-header', trailingslashit(get_template_directory_uri()) . 'css/admin-custom-header.css'); }
/** * Register customizer preview scripts. * * @since 3.0.0 * @access public * @return void */ function hybrid_customize_preview_register_scripts() { wp_register_script('hybrid-customize-preview', HYBRID_JS . 'customize-preview' . hybrid_get_min_suffix() . '.js', array('jquery'), null, true); }
/** * Enqueues scripts. * * @since 1.0.0 * @access public * @return void */ function stargazer_enqueue_scripts() { $suffix = hybrid_get_min_suffix(); wp_register_script('stargazer', trailingslashit(get_template_directory_uri()) . "js/stargazer{$suffix}.js", array('jquery'), null, true); wp_localize_script('stargazer', 'stargazer_i18n', array('search_toggle' => __('Expand Search Form', 'stargazer'))); wp_enqueue_script('stargazer'); }
/** * Returns the parent theme editor stylesheet URI. * * @since 3.0.0 * @access public * @return string */ function stargazer_get_parent_editor_stylesheet_uri() { $style_uri = ''; $suffix = hybrid_get_min_suffix(); $dir = trailingslashit(get_template_directory()); $uri = trailingslashit(get_template_directory_uri()); if ($suffix && file_exists("{$dir}css/editor-style{$suffix}.css")) { $style_uri = "{$uri}css/editor-style{$suffix}.css"; } else { if (file_exists("{$dir}css/editor-style.css")) { $style_uri = "{$uri}css/editor-style.css"; } } return $style_uri; }
/** * Add editor style */ function ejo_add_editor_styles() { $suffix = hybrid_get_min_suffix(); /* External font */ // $font_url = str_replace( ',', '%2C', '//fonts.googleapis.com/css?family=Roboto:300,300italic,500,500italic|Roboto+Slab:700' ); // add_editor_style( $font_url ); /* Editor Style */ add_editor_style(THEME_CSS_URI . "editor-style{$suffix}.css"); }
/** * Load scripts for the front end. */ function croft_enqueue_scripts() { $suffix = hybrid_get_min_suffix(); wp_enqueue_script('theme-js', trailingslashit(get_template_directory_uri()) . "assets/js/main{$suffix}.js", array('jquery'), null, true); }
/** * 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.2.0 * @access public * @return void */ function hybrid_register_scripts() { // Register the 'mobile-toggle' script'. wp_register_script('hybrid-mobile-toggle', HYBRID_JS . 'mobile-toggle' . hybrid_get_min_suffix() . '.js', array('jquery'), '20130528', true); }
/** * Filters the '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 SCRIPT_DEBUG * is disabled. * * @since 1.5.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 hybrid_min_stylesheet_uri($stylesheet_uri, $stylesheet_dir_uri) { /* Get the minified suffix. */ $suffix = hybrid_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; }
/** * Loads theme customizer CSS. * * @since 1.0.0 * @access public * @return void */ function saga_customize_controls_print_styles() { $suffix = hybrid_get_min_suffix(); wp_enqueue_style('font-awesome', trailingslashit(get_template_directory_uri()) . "css/font-awesome{$suffix}.css"); }
/** * Enqueue theme scripts. * * @since 1.0.0 * @access public * @return void */ function compass_enqueue_scripts() { $js_dir = trailingslashit(get_template_directory_uri()) . 'js/'; $suffix = hybrid_get_min_suffix(); wp_enqueue_script('compass', $js_dir . "theme{$suffix}.js", array('jquery'), null, true); }