/** * Load scripts for the front end. * * @since 1.0 * @access public * @return void */ function hoot_base_enqueue_scripts() { /* Load jquery */ wp_enqueue_script('jquery'); /* Load modernizr */ $script_uri = hoot_locate_script('js/modernizr.custom'); wp_enqueue_script('modernizr', $script_uri, array(), '2.8.3'); /* Load Superfish and WP's hoverIntent */ // WordPress prior to v3.6 uses an older version of HoverIntent which doesn't support event delegation :( wp_enqueue_script('hoverIntent'); $script_uri = hoot_locate_script('js/jquery.superfish'); wp_enqueue_script('superfish', $script_uri, array('jquery', 'hoverIntent'), '1.7.5', true); /* Load lightSlider if 'light-slider' is active. */ if (current_theme_supports('light-slider')) { $script_uri = hoot_locate_script('js/jquery.lightSlider'); wp_enqueue_script('lightSlider', $script_uri, array('jquery'), '1.1.1', true); } /* Load fitvids */ $script_uri = hoot_locate_script('js/jquery.fitvids'); wp_enqueue_script('fitvids', $script_uri, array(), '1.1', true); /* Load Theme Javascript */ $script_uri = hoot_locate_script('js/hoot.theme'); wp_enqueue_script('hoot-theme', $script_uri, array(), THEME_VERSION, true); /* Localize Theme Javascript - Must be called after the script has been registered. */ hoot_localize_theme_script(); }
/** * 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'); /* Register the 'mobile-toggle' script if the current theme supports 'mobile-toggle'. */ if (isset($supports[0]) && in_array('mobile-toggle', $supports[0])) { $script_uri = hoot_locate_script(trailingslashit(HOOT_JS) . 'mobile-toggle'); wp_register_script('hoot-mobile-toggle', $script_uri, 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) { /* Enqueue Styles */ wp_enqueue_style('hoot-font-awesome'); $style_uri = hoot_locate_style(trailingslashit(HOOT_CSS) . 'admin-widgets'); wp_enqueue_style('hoot-admin-widgets', $style_uri, array(), HOOT_VERSION); /* Enqueue Scripts */ // Load admin-widgets in footer to maintain script heirarchy $script_uri = hoot_locate_script(trailingslashit(HOOT_JS) . 'admin-widgets'); wp_enqueue_script('hoot-admin-widgets', $script_uri, array('jquery'), HOOT_VERSION, true); } }