/** * Register and enqueue the styles and scripts for all builder * layouts in the main WordPress query. * * @since 1.0 * @return void */ public static function layout_styles_scripts() { global $wp_query; global $post; $original_post = $post; $ver = FL_BUILDER_VERSION; $css_url = plugins_url('/css/', FL_BUILDER_FILE); $js_url = plugins_url('/js/', FL_BUILDER_FILE); // Register additional CSS wp_register_style('font-awesome', $css_url . 'font-awesome.min.css', array(), $ver); wp_register_style('foundation-icons', $css_url . 'foundation-icons.css', array(), $ver); wp_register_style('fl-slideshow', $css_url . 'fl-slideshow.css', array(), $ver); wp_register_style('jquery-bxslider', $css_url . 'jquery.bxslider.css', array(), $ver); wp_register_style('jquery-magnificpopup', $css_url . 'jquery.magnificpopup.css', array(), $ver); // Register additional JS wp_register_script('fl-slideshow', $js_url . 'fl-slideshow.js', array('yui3'), $ver, true); wp_register_script('fl-gallery-grid', $js_url . 'fl-gallery-grid.js', array('jquery'), $ver, true); wp_register_script('jquery-bxslider', $js_url . 'jquery.bxslider.min.js', array('jquery-easing', 'jquery-fitvids'), $ver, true); wp_register_script('jquery-easing', $js_url . 'jquery.easing.1.3.js', array('jquery'), '1.3', true); wp_register_script('jquery-fitvids', $js_url . 'jquery.fitvids.js', array('jquery'), $ver, true); wp_register_script('jquery-imagesloaded', $js_url . 'jquery.imagesloaded.js', array('jquery'), $ver, true); wp_register_script('jquery-infinitescroll', $js_url . 'jquery.infinitescroll.js', array('jquery'), $ver, true); wp_register_script('jquery-magnificpopup', $js_url . 'jquery.magnificpopup.min.js', array('jquery'), $ver, true); wp_register_script('jquery-mosaicflow', $js_url . 'jquery.mosaicflow.min.js', array('jquery'), $ver, true); wp_register_script('jquery-waypoints', $js_url . 'jquery.waypoints.min.js', array('jquery'), $ver, true); wp_register_script('jquery-wookmark', $js_url . 'jquery.wookmark.min.js', array('jquery'), $ver, true); // YUI 3 (Needed for the slideshow) if (FLBuilderModel::is_ssl()) { wp_register_script('yui3', 'https://yui-s.yahooapis.com/3.5.1/build/yui/yui-min.js', array(), '3.5.1', false); } else { wp_register_script('yui3', 'http://yui.yahooapis.com/3.5.1/build/yui/yui-min.js', array(), '3.5.1', false); } // Enqueue assets for posts in the main query. if (isset($wp_query->posts)) { foreach ($wp_query->posts as $post) { self::enqueue_layout_styles_scripts($post->ID); } } // Enqueue assets for posts via the fl_builder_global_posts filter. $post_ids = FLBuilderModel::get_global_posts(); if (count($post_ids) > 0) { $posts = get_posts(array('post__in' => $post_ids, 'post_type' => get_post_types(), 'posts_per_page' => -1)); foreach ($posts as $post) { self::enqueue_layout_styles_scripts($post->ID); } } // Reset the global post variable. $post = $original_post; }
/** * Register the styles and scripts for builder layouts. * * @since 1.7.4 * @return void */ public static function register_layout_styles_scripts() { $ver = FL_BUILDER_VERSION; $css_url = plugins_url('/css/', FL_BUILDER_FILE); $js_url = plugins_url('/js/', FL_BUILDER_FILE); // Register additional CSS wp_register_style('font-awesome', $css_url . 'font-awesome.min.css', array(), $ver); wp_register_style('foundation-icons', $css_url . 'foundation-icons.css', array(), $ver); wp_register_style('fl-slideshow', $css_url . 'fl-slideshow.css', array(), $ver); wp_register_style('jquery-bxslider', $css_url . 'jquery.bxslider.css', array(), $ver); wp_register_style('jquery-magnificpopup', $css_url . 'jquery.magnificpopup.css', array(), $ver); // Register additional JS wp_register_script('fl-slideshow', $js_url . 'fl-slideshow.js', array('yui3'), $ver, true); wp_register_script('fl-gallery-grid', $js_url . 'fl-gallery-grid.js', array('jquery'), $ver, true); wp_register_script('jquery-bxslider', $js_url . 'jquery.bxslider.min.js', array('jquery-easing', 'jquery-fitvids'), $ver, true); wp_register_script('jquery-easing', $js_url . 'jquery.easing.1.3.js', array('jquery'), '1.3', true); wp_register_script('jquery-fitvids', $js_url . 'jquery.fitvids.js', array('jquery'), $ver, true); wp_register_script('jquery-imagesloaded', $js_url . 'jquery.imagesloaded.js', array('jquery'), $ver, true); wp_register_script('jquery-infinitescroll', $js_url . 'jquery.infinitescroll.js', array('jquery'), $ver, true); wp_register_script('jquery-magnificpopup', $js_url . 'jquery.magnificpopup.min.js', array('jquery'), $ver, true); wp_register_script('jquery-mosaicflow', $js_url . 'jquery.mosaicflow.min.js', array('jquery'), $ver, true); wp_register_script('jquery-waypoints', $js_url . 'jquery.waypoints.min.js', array('jquery'), $ver, true); wp_register_script('jquery-wookmark', $js_url . 'jquery.wookmark.min.js', array('jquery'), $ver, true); // YUI 3 (Needed for the slideshow) if (FLBuilderModel::is_ssl()) { wp_register_script('yui3', 'https://yui-s.yahooapis.com/3.5.1/build/yui/yui-min.js', array(), '3.5.1', false); } else { wp_register_script('yui3', 'http://yui.yahooapis.com/3.5.1/build/yui/yui-min.js', array(), '3.5.1', false); } }