function themerex_scripts() { global $concatenate_scripts; $concatenate_scripts = get_theme_option('compose_scripts') == 'yes'; //Enqueue styles $fonts = getThemeFontsList(false); $font = get_custom_option('theme_font'); if (isset($fonts[$font])) { $theme_font_link = $fonts[$font]['link']; } else { $theme_font_link = "Oxygen:400,700"; } $font = get_custom_option('logo_font'); if (isset($fonts[$font])) { $logo_font_link = $fonts[$font]['link']; } else { $logo_font_link = "Cabin:700"; } // Must be loaded before main stylesheet wp_enqueue_style('theme-font', 'http://fonts.googleapis.com/css?family=' . $theme_font_link . '&subset=latin,cyrillic-ext,latin-ext,cyrillic', array(), null); wp_enqueue_style('logo-font', 'http://fonts.googleapis.com/css?family=' . $logo_font_link . '&subset=latin,cyrillic-ext,latin-ext,cyrillic', array(), null); wp_enqueue_style('fontello', get_template_directory_uri() . '/includes/fontello/css/fontello.css', array(), null); wp_enqueue_style('animation', get_template_directory_uri() . '/includes/fontello/css/animation.css', array(), null); // Main stylesheet wp_enqueue_style('main-style', get_stylesheet_uri(), array(), null); // Themes $themes = array(); $themes[get_custom_option('blog_theme')] = 1; $themes[get_custom_option('sidebar_main_theme')] = 1; $themes[get_custom_option('sidebar_advert_theme')] = 1; $themes[get_custom_option('sidebar_footer_theme')] = 1; foreach ($themes as $style => $v) { wp_enqueue_style('theme-' . $style, esc_url(get_template_directory_uri() . '/css/themes/' . $style . '.css'), array('main-style'), null); } // Shortcodes wp_enqueue_style('shortcodes', get_template_directory_uri() . '/css/shortcodes.css', array('main-style'), null); // Customizer wp_add_inline_style('shortcodes', prepareThemeCustomStyles()); // Responsive if (get_theme_option('responsive_layouts') == 'yes') { wp_enqueue_style('responsive', get_template_directory_uri() . '/css/responsive.css', array('main-style'), null); } // WooCommerce customizer if (function_exists('is_woocommerce')) { wp_enqueue_style('woo-style', get_template_directory_uri() . '/css/woo-style.css', array('main-style'), null); } // BuddyPress customizer if (class_exists('BuddyPress')) { wp_enqueue_style('buddy-style', get_template_directory_uri() . '/css/buddy-style.css', array('main-style'), null); } // BB Press customizer if (class_exists('bbPress')) { wp_enqueue_style('bbpress-style', get_template_directory_uri() . '/css/bbpress-style.css', array('main-style'), null); } // Loads the Internet Explorer specific stylesheet. wp_enqueue_style('puzzles-ie', get_template_directory_uri() . '/css/ie.css', array('main-style'), null); wp_style_add_data('puzzles-ie', 'conditional', 'lt IE 10'); // RTL support if (get_bloginfo('text_direction') == 'rtl') { wp_enqueue_style('shortcodes_rtl', get_template_directory_uri() . '/css/shortcodes_rtl.css'); wp_enqueue_style('bbpress_rtl', get_template_directory_uri() . '/css/bbpress-style_rtl.css'); wp_enqueue_style('buddy-style_rtl', get_template_directory_uri() . '/css/buddy-style_rtl.css'); wp_enqueue_style('woo-style_rtl', get_template_directory_uri() . '/css/woo-style_rtl.css'); } wp_enqueue_script('jquery', false, array(), null, true); wp_enqueue_script('jquery-cookie', get_template_directory_uri() . '/js/jquery.cookie.js', array('jquery'), null, true); wp_enqueue_script('jquery-easing', get_template_directory_uri() . '/js/jquery.easing.js', array('jquery'), null, true); wp_enqueue_script('superfish', get_template_directory_uri() . '/js/superfish.js', array('jquery'), null, true); if (get_theme_option('responsive_layouts') == 'yes') { wp_enqueue_script('mobilemenu', get_template_directory_uri() . '/js/jquery.mobilemenu.min.js', array('jquery'), null, true); } if (get_theme_option('menu_slider') == 'yes') { wp_enqueue_script('slidemenu', get_template_directory_uri() . '/js/jquery.slidemenu.js', array('jquery'), null, true); } wp_enqueue_script('skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), null, true); wp_enqueue_script('_utils', get_template_directory_uri() . '/js/_utils.js', array(), null, true); if (get_bloginfo('text_direction') == 'rtl') { wp_enqueue_script('_front', get_template_directory_uri() . '/js/_frontrtl.js', array(), null, true); } else { wp_enqueue_script('_front', get_template_directory_uri() . '/js/_front.js', array(), null, true); } wp_enqueue_script('_reviews', get_template_directory_uri() . '/js/_reviews.js', array('jquery'), null, true); wp_enqueue_style('prettyphoto-style', get_template_directory_uri() . '/js/prettyphoto/css/prettyPhoto.css', array(), null); wp_enqueue_script('prettyphoto', get_template_directory_uri() . '/js/prettyphoto/jquery.prettyPhoto.min.js', array('jquery'), 'no-compose', true); wp_enqueue_script('flexslider', get_template_directory_uri() . '/js/jquery.flexslider.min.js', array('jquery'), null, true); if (get_theme_option('use_mediaelement') == 'yes') { wp_enqueue_style('mediaplayer-style', get_template_directory_uri() . '/js/mediaplayer/mediaelementplayer.css', array(), null); wp_enqueue_script('mediaplayer', get_template_directory_uri() . '/js/mediaplayer/mediaelement-and-player.min.js', array(), null, true); } if (is_singular() && get_theme_option('show_share') == 'yes') { wp_enqueue_script('social-share', get_template_directory_uri() . '/js/social/social-share.js', array(), null, true); } if (is_singular() && comments_open() && get_option('thread_comments')) { wp_enqueue_script('comment-reply', false, array(), null, true); } if (get_theme_option('show_theme_customizer') == 'yes') { wp_enqueue_script('jquery-ui-draggable', false, array('jquery', 'jquery-ui-core'), null, true); } }
function themerex_scripts() { global $wp_styles, $concatenate_scripts; $concatenate_scripts = get_theme_option('debug_mode') == 'no' && get_theme_option('compose_scripts') == 'yes'; // Enqueue styles //----------------------------------------------------------------------------------------------------- $fonts = getThemeFontsList(false); $theme_fonts = array(); // Prepare custom fonts if (get_custom_option('typography_custom') == 'yes') { $selectors = array('p', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6'); foreach ($selectors as $s) { $font = get_custom_option('typography_' . $s . '_font'); if (!empty($font)) { $theme_fonts[$font] = 1; } } } // Prepare current skin fonts $theme_fonts = apply_filters('theme_skin_use_fonts', $theme_fonts); // Link to selected fonts foreach ($theme_fonts as $font => $v) { if (isset($fonts[$font])) { $font_name = ($pos = themerex_strpos($font, ' (')) !== false ? themerex_substr($font, 0, $pos) : $font; $css = !empty($fonts[$font]['css']) ? $fonts[$font]['css'] : 'http://fonts.googleapis.com/css?family=' . (!empty($fonts[$font]['link']) ? $fonts[$font]['link'] : str_replace(' ', '+', $font_name) . ':100,100italic,300,300italic,400,400italic,700,700italic') . '&subset=latin,latin-ext,cyrillic,cyrillic-ext'; themerex_enqueue_style('theme-font-' . str_replace(' ', '-', $font_name), $css, array(), null); } } // Fontello styles must be loaded before main stylesheet themerex_enqueue_style('fontello', themerex_get_file_url('/css/fontello/css/fontello.css'), array(), null); themerex_enqueue_style('animation', themerex_get_file_url('/css/fontello/css/animation.css'), array(), null); // Main stylesheet themerex_enqueue_style('main-style', get_stylesheet_uri(), array(), null); // WooCommerce customizer if (function_exists('is_woocommerce')) { themerex_enqueue_style('woo-style', themerex_get_file_url('/css/woo-style.css'), array('main-style'), null); } // Tribe Events if (class_exists('TribeEvents')) { $wp_styles->done[] = 'tribe-events-custom-jquery-styles'; themerex_enqueue_style('tribe-style', themerex_get_file_url('/css/tribe-style.css'), array('main-style'), null); } // BuddyPress customizer if (class_exists('BuddyPress')) { themerex_enqueue_style('buddy-style', themerex_get_file_url('/css/buddy-style.css'), array('main-style'), null); } // BB Press customizer if (class_exists('bbPress')) { themerex_enqueue_style('bbpress-style', themerex_get_file_url('/css/bbpress-style.css'), array('main-style'), null); } if (get_theme_option('debug_mode') == 'no' && get_theme_option('packed_scripts') == 'yes' && file_exists(themerex_get_file_dir('/css/__packed.css'))) { // Load packed styles themerex_enqueue_style('packed-styles', themerex_get_file_url('/css/__packed.css'), array('main-style'), null); } else { // Magnific popup themerex_enqueue_style('magnific-style', themerex_get_file_url('/js/magnific-popup/magnific-popup.css'), array(), null); // Swiper slider themerex_enqueue_style('swiperslider-style', themerex_get_file_url('/js/swiper/idangerous.swiper.css'), array(), null); themerex_enqueue_style('swiperslider-scrollbar-style', themerex_get_file_url('/js/swiper/idangerous.swiper.scrollbar.css'), array(), null); // Messages themerex_enqueue_style('messages-style', themerex_get_file_url('/js/messages/_messages.css'), array('main-style'), null); // Additional hovers for portfolio themerex_enqueue_style('ihover-styles', themerex_get_file_url('/css/ihover.css'), array(), null); // Shortcodes themerex_enqueue_style('shortcodes', themerex_get_file_url('/shortcodes/shortcodes.css'), array('main-style'), null); } // Main slider if (get_custom_option('slider_show') == 'yes') { themerex_enqueue_style('main-slider-style', themerex_get_file_url('/css/slider-style.css'), array(), null); } // Theme skin stylesheet do_action('theme_skin_add_stylesheets'); // Custom fonts and colors if (get_custom_option('theme_skin') != '') { wp_add_inline_style('theme-skin', prepareThemeCustomStyles()); } else { if (get_theme_option('debug_mode') == 'no' && get_theme_option('packed_scripts') == 'yes' && file_exists(themerex_get_file_dir('/css/__packed.css'))) { wp_add_inline_style('packed-styles', prepareThemeCustomStyles()); } else { wp_add_inline_style('shortcodes', prepareThemeCustomStyles()); } } // Responsive if (get_theme_option('responsive_layouts') == 'yes') { themerex_enqueue_style('responsive', themerex_get_file_url('/css/responsive.css'), array('main-style'), null); do_action('theme_skin_add_responsive'); if (get_custom_option('theme_skin') != '') { $css = apply_filters('theme_skin_add_responsive_inline', ''); if (!empty($css)) { wp_add_inline_style('responsive', $css); } } } // Enqueue scripts //---------------------------------------------------------------------------------------------------------------------------- themerex_enqueue_script('jquery', false, array(), null, true); themerex_enqueue_script('jquery-ui-core', false, array(), null, true); themerex_enqueue_script('jquery-ui-tabs', false, array('jquery', 'jquery-ui-core'), null, true); themerex_enqueue_script('jquery-effects-core', false, array(), null, true); themerex_enqueue_script('jquery-effects-fade', false, array('jquery', 'jquery-effects-core'), null, true); if (get_custom_option('show_top_page') == 'yes' && get_custom_option('show_sidebar_top') == 'yes') { themerex_enqueue_script('jquery-effects-drop', false, array('jquery', 'jquery-effects-drop'), null, true); } if (get_theme_option('debug_mode') == 'no' && get_theme_option('packed_scripts') == 'yes' && file_exists(themerex_get_file_dir('/js/__packed.js'))) { // Load packed theme scripts themerex_enqueue_script('packed-scripts', themerex_get_file_url('/js/__packed.js'), array('jquery'), null, true); } else { // Load separate theme scripts themerex_enqueue_script('jquery-cookie', themerex_get_file_url('/js/jquery.cookie.js'), array('jquery'), null, true); themerex_enqueue_script('jquery-easing', themerex_get_file_url('/js/jquery.easing.js'), array('jquery'), null, true); themerex_enqueue_script('jquery-autosize', themerex_get_file_url('/js/jquery.autosize.js'), array('jquery'), null, true); themerex_enqueue_script('superfish', themerex_get_file_url('/js/superfish.min.js'), array('jquery'), null, true); themerex_enqueue_script('magnific', themerex_get_file_url('/js/magnific-popup/jquery.magnific-popup.min.js'), array('jquery'), null, true); themerex_enqueue_script('swiperslider', themerex_get_file_url('/js/swiper/idangerous.swiper-2.7.js'), array('jquery'), null, true); themerex_enqueue_script('swiperslider-scrollbar', themerex_get_file_url('/js/swiper/idangerous.swiper.scrollbar-2.4.js'), array('jquery'), null, true); themerex_enqueue_script('flexslider', themerex_get_file_url('/js/jquery.flexslider.min.js'), array('jquery'), null, true); themerex_enqueue_script('smooth-scroll', themerex_get_file_url('/js/SmoothScroll.min.js'), array('jquery'), null, true); themerex_enqueue_script('hover-dir', themerex_get_file_url('/js/hover/jquery.hoverdir.js'), array(), null, true); themerex_enqueue_script('hover-intent', themerex_get_file_url('/js/hover/hoverIntent.js'), array(), null, true); themerex_enqueue_script('messages', themerex_get_file_url('/js/messages/_messages.js'), array(), null, true); themerex_enqueue_script('diagram-chart', themerex_get_file_url('/js/diagram/chart.min.js'), array(), null, true); themerex_enqueue_script('diagram-raphael', themerex_get_file_url('/js/diagram/diagram.raphael.min.js'), array(), 'no-compose', true); themerex_enqueue_script('shortcodes-init', themerex_get_file_url('/shortcodes/shortcodes_init.js'), array(), null, true); themerex_enqueue_script('_utils', themerex_get_file_url('/js/_utils.js'), array(), null, true); themerex_enqueue_script('_front', themerex_get_file_url('/js/_front.js'), array(), null, true); themerex_enqueue_script('_reviews', themerex_get_file_url('/js/_reviews.js'), array('jquery'), null, true); } if (file_exists(themerex_get_file_dir('/js/chopslider/jquery.id.chopslider-2.0.0.free.min.js'))) { themerex_enqueue_script('chopslider', themerex_get_file_url('/js/chopslider/jquery.id.chopslider-2.0.0.free.min.js'), array('jquery'), null, true); themerex_enqueue_script('cstransitions', themerex_get_file_url('/js/chopslider/jquery.id.cstransitions-1.0.min.js'), array('jquery'), null, true); } // Load Isotope separately (don't included in the __packed) - Visual Composer (new version) reload isotope themerex_enqueue_script('isotope', themerex_get_file_url('/js/jquery.isotope.min.js'), array(), null, true); // Load PrettyPhoto if it selected in Theme Options if (get_theme_option('popup_engine') == 'pretty') { themerex_enqueue_style('prettyphoto-style', themerex_get_file_url('/js/prettyphoto/css/prettyPhoto.css'), array(), null); themerex_enqueue_script('prettyphoto', themerex_get_file_url('/js/prettyphoto/jquery.prettyPhoto.min.js'), array('jquery'), 'no-compose', true); } // Media elements library if (get_theme_option('use_mediaelement') == 'yes') { if (floatval(get_bloginfo('version')) < "3.6") { themerex_enqueue_style('mediaplayer-style', themerex_get_file_url('/js/mediaplayer/mediaplayer.css'), array(), null); themerex_enqueue_script('mediaplayer', themerex_get_file_url('/js/mediaplayer/mediaelement.min.js'), array(), null, true); } else { wp_enqueue_style('mediaelement'); wp_enqueue_style('wp-mediaelement'); wp_enqueue_script('mediaelement'); wp_enqueue_script('wp-mediaelement'); } } else { global $wp_scripts; $wp_scripts->done[] = 'mediaelement'; $wp_scripts->done[] = 'wp-mediaelement'; $wp_styles->done[] = 'mediaelement'; $wp_styles->done[] = 'wp-mediaelement'; } // Video background if (get_custom_option('show_video_bg') == 'yes' && get_custom_option('video_bg_youtube_code') != '') { themerex_enqueue_script('video-bg', themerex_get_file_url('/js/jquery.tubular.1.0.js'), array('jquery'), null, true); } // Google map if (get_custom_option('googlemap_show') == 'yes') { themerex_enqueue_script('googlemap', 'http://maps.google.com/maps/api/js?sensor=false', array(), null, true); themerex_enqueue_script('googlemap_init', themerex_get_file_url('/js/_googlemap_init.js'), array(), null, true); } // Sound effects on mouse hover if (get_custom_option('sound_enable') == 'yes') { themerex_enqueue_script('sound-manager', themerex_get_file_url('/js/sounds/soundmanager2-nodebug-js.min.js'), array('jquery'), null, true); } // Social share buttons if (is_singular() && get_theme_option('show_share') == 'yes') { themerex_enqueue_script('social-share', themerex_get_file_url('/js/social/social-share.js'), array(), null, true); } // Login form if (get_custom_option('show_login') == 'yes') { themerex_enqueue_script('form-login', themerex_get_file_url('/js/_form_login.js'), array(), null, true); } // Comments if (is_singular() && comments_open() && get_option('thread_comments')) { themerex_enqueue_script('comment-reply', false, array(), null, true); themerex_enqueue_script('form-comments', themerex_get_file_url('/js/_form_comments.js'), array(), null, true); } // Right panel if (get_theme_option('show_right_panel') == 'yes') { themerex_enqueue_script('jquery-ui-draggable', false, array('jquery', 'jquery-ui-core'), null, true); themerex_enqueue_script('jquery-ui-sortable', false, array('jquery', 'jquery-ui-core'), null, true); if (get_theme_option('show_theme_customizer') == 'yes') { themerex_enqueue_script('_customizer', themerex_get_file_url('/js/_customizer.js'), array(), null, true); } } // Theme skin script do_action('theme_skin_add_scripts'); }
function themerex_scripts() { global $concatenate_scripts; $concatenate_scripts = get_theme_option('compose_scripts') == 'yes'; //custom fonts $fonts = getThemeFontsList(false); $fontArray = array('theme_font', 'header_font', 'logo_font'); $fontUsed = array(); foreach ($fontArray as $fnt) { $fnt = get_custom_option($fnt); if (!in_array($fnt, $fontUsed)) { $fontUsed[] = $fnt; if (isset($fonts[$fnt])) { $theme_font_link = !empty($fonts[$fnt]['link']) ? $fonts[$fnt]['link'] : str_replace(' ', '+', $fnt) . ' :100,100italic,300,300italic,400,400italic,500,500italic,700,700italic,900,900italic'; themerex_enqueue_style('theme-font-' . str_replace(' ', '_', $fnt), 'http://fonts.googleapis.com/css?family=' . $theme_font_link . '&subset=latin,cyrillic-ext,latin-ext,cyrillic', array(), null); } } } themerex_enqueue_style('fontello', get_template_directory_uri() . '/includes/fontello/css/fontello.css', array(), null); themerex_enqueue_style('animation', get_template_directory_uri() . '/includes/fontello/css/animation.css', array(), null); // Main stylesheet themerex_enqueue_style('main-style', get_stylesheet_uri(), array(), null); // Shortcodes themerex_enqueue_style('shortcodes', get_template_directory_uri() . '/includes/shortcodes/shortcodes.css', array('main-style'), null); // Customizer wp_add_inline_style('shortcodes', prepareThemeCustomStyles()); // Responsive if (get_theme_option('responsive_layouts') == 'yes') { themerex_enqueue_style('responsive', get_template_directory_uri() . '/css/responsive.css', array('main-style'), null); } // WooCommerce customizer if (function_exists('is_woocommerce')) { themerex_enqueue_style('woo-style', get_template_directory_uri() . '/css/woo-style.css', array('main-style'), null); } // BuddyPress customizer if (class_exists('BuddyPress')) { themerex_enqueue_style('buddy-style', get_template_directory_uri() . '/css/buddy-style.css', array('main-style'), null); } // BB Press customizer if (class_exists('bbPress')) { themerex_enqueue_style('bbpress-style', get_template_directory_uri() . '/css/bbpress-style.css', array('main-style'), null); } // Load scripts themerex_enqueue_script('jquery', false, array(), null, true); themerex_enqueue_script('jquery-cookie', get_template_directory_uri() . '/js/jquery.cookie.js', array('jquery'), null, true); themerex_enqueue_script('jquery-easing', get_template_directory_uri() . '/js/jquery.easing.js', array('jquery'), null, true); themerex_enqueue_script('jquery-autosize', get_template_directory_uri() . '/js/jquery.autosize.js', array('jquery'), null, true); themerex_enqueue_script('jquery-ui-core', false, array(), null, true); themerex_enqueue_script('jquery-ui-tabs', false, array('jquery', 'jquery-ui-core'), null, true); themerex_enqueue_script('jquery-effects-core', false, array(), null, true); themerex_enqueue_script('jquery-effects-fade', false, array('jquery', 'jquery-effects-core'), null, true); themerex_enqueue_script('superfish', get_template_directory_uri() . '/js/superfish.js', array('jquery'), null, true); themerex_enqueue_script('_utils', get_template_directory_uri() . '/js/_utils.js', array(), null, true); themerex_enqueue_script('_front', get_template_directory_uri() . '/js/_front.js', array(), null, true); themerex_enqueue_script('shortcodes-init', get_template_directory_uri() . '/includes/shortcodes/shortcodes_init.js', array(), null, true); themerex_enqueue_script('smooth-scroll', get_template_directory_uri() . '/js/SmoothScroll.js', array(), null, true); if (get_theme_option('use_mediaelement') == 'yes') { if (floatval(get_bloginfo('version')) > "3.6") { themerex_enqueue_style('wp-mediaelement'); themerex_enqueue_script('wp-playlist'); } else { global $wp_scripts, $wp_styles; $wp_styles->done[] = 'mediaelement'; $wp_styles->done[] = 'wp-mediaelement'; $wp_scripts->done[] = 'mediaelement'; $wp_scripts->done[] = 'wp-mediaelement'; themerex_enqueue_script('mediaplayer', get_template_directory_uri() . '/js/mediaelement/mediaelement.min.js', array(), null, true); themerex_enqueue_style('mediaplayer-style', get_template_directory_uri() . '/js/mediaelement/mediaelement.css', array(), null); } themerex_enqueue_style('mediaelement-custom', get_template_directory_uri() . '/js/mediaelement/mediaplayer_custom.css', array(), null); } else { global $wp_scripts, $wp_styles; $wp_styles->done[] = 'mediaelement'; $wp_styles->done[] = 'wp-mediaelement'; $wp_scripts->done[] = 'mediaelement'; $wp_scripts->done[] = 'wp-mediaelement'; } if (is_singular() && get_theme_option('show_share') == 'yes') { themerex_enqueue_script('social-share', get_template_directory_uri() . '/js/social/social-share.js', array(), null, true); } if (get_custom_option('show_login') == 'yes') { themerex_enqueue_script('form-login', get_template_directory_uri() . '/js/_form_login.js', array(), null, true); } if (get_theme_option('show_theme_customizer') == 'yes') { themerex_enqueue_script('jquery-ui-draggable', false, array('jquery', 'jquery-ui-core'), null, true); themerex_enqueue_script('_customizer', get_template_directory_uri() . '/js/_customizer.js', array(), null, true); } if (get_theme_option("allow_editor") == 'yes' && (is_single() && current_user_can('edit_posts', get_the_ID()) || is_page() && current_user_can('edit_pages', get_the_ID()))) { themerex_enqueue_style('frontend-editor-style', get_template_directory_uri() . '/js/editor/_editor.css', array('main-style'), null); themerex_enqueue_script('frontend-editor', get_template_directory_uri() . '/js/editor/_editor.js', array(), null, true); } themerex_enqueue_style('messages-style', get_template_directory_uri() . '/js/messages/_messages.css', array('main-style'), null); themerex_enqueue_script('messages', get_template_directory_uri() . '/js/messages/_messages.js', array(), null, true); }
function themerex_scripts() { global $concatenate_scripts; $concatenate_scripts = get_theme_option('compose_scripts') == 'yes'; //Enqueue styles $fonts = getThemeFontsList(false); $font = get_custom_option('theme_font'); if (isset($fonts[$font])) { $theme_font_link = !empty($fonts[$font]['link']) ? $fonts[$font]['link'] : str_replace(' ', '+', $font) . ':100,100italic,300,300italic,400,400italic,500,500italic,700,700italic,900,900italic'; } else { $theme_font_link = "Roboto:100,100italic,300,300italic,400,400italic,500,500italic,700,700italic,900,900italic"; } // Must be loaded before main stylesheet wp_enqueue_style('theme-font', 'http://fonts.googleapis.com/css?family=' . $theme_font_link . '&subset=latin,cyrillic-ext,latin-ext,cyrillic', array(), null); wp_enqueue_style('fontello', get_template_directory_uri() . '/includes/fontello/css/fontello.css', array(), null); wp_enqueue_style('animation', get_template_directory_uri() . '/includes/fontello/css/animation.css', array(), null); // Main stylesheet wp_enqueue_style('main-style', get_stylesheet_uri(), array(), null); // Shortcodes wp_enqueue_style('shortcodes', get_template_directory_uri() . '/includes/shortcodes/shortcodes.css', array('main-style'), null); // Customizer wp_add_inline_style('shortcodes', prepareThemeCustomStyles()); // Responsive if (get_theme_option('responsive_layouts') == 'yes') { wp_enqueue_style('responsive', get_template_directory_uri() . '/css/responsive.css', array('main-style'), null); } // WooCommerce customizer if (function_exists('is_woocommerce')) { wp_enqueue_style('woo-style', get_template_directory_uri() . '/css/woo-style.css', array('main-style'), null); } // BuddyPress customizer if (class_exists('BuddyPress')) { wp_enqueue_style('buddy-style', get_template_directory_uri() . '/css/buddy-style.css', array('main-style'), null); } // BB Press customizer if (class_exists('bbPress')) { wp_enqueue_style('bbpress-style', get_template_directory_uri() . '/css/bbpress-style.css', array('main-style'), null); } // Load scripts wp_enqueue_script('jquery', false, array(), null, true); wp_enqueue_script('underscore', false, array(), null, true); wp_enqueue_script('jquery-cookie', get_template_directory_uri() . '/js/jquery.cookie.js', array('jquery'), null, true); wp_enqueue_script('jquery-easing', get_template_directory_uri() . '/js/jquery.easing.js', array('jquery'), null, true); wp_enqueue_script('jquery-autosize', get_template_directory_uri() . '/js/jquery.autosize.js', array('jquery'), null, true); wp_enqueue_script('jquery-ui-core', false, array(), null, true); wp_enqueue_script('jquery-ui-tabs', false, array('jquery', 'jquery-ui-core'), null, true); wp_enqueue_script('jquery-effects-core', false, array(), null, true); wp_enqueue_script('jquery-effects-fade', false, array('jquery', 'jquery-effects-core'), null, true); wp_enqueue_script('superfish', get_template_directory_uri() . '/js/superfish.js', array('jquery'), null, true); wp_enqueue_script('_utils', get_template_directory_uri() . '/js/_utils.js', array(), null, true); wp_enqueue_script('_front', get_template_directory_uri() . '/js/_front.js', array(), null, true); wp_enqueue_script('shortcodes-init', get_template_directory_uri() . '/includes/shortcodes/shortcodes_init.js', array(), null, true); wp_enqueue_style('magnific-style', get_template_directory_uri() . '/js/magnific-popup/magnific-popup.css', array(), null); wp_enqueue_script('magnific', get_template_directory_uri() . '/js/magnific-popup/jquery.magnific-popup.min.js', array('jquery'), null, true); wp_enqueue_script('flexslider', get_template_directory_uri() . '/js/jquery.flexslider-min.js', array('jquery'), null, true); wp_enqueue_style('swiperslider-style', get_template_directory_uri() . '/js/swiper/idangerous.swiper.css', array(), null); wp_enqueue_script('swiperslider', get_template_directory_uri() . '/js/swiper/idangerous.swiper.js', array('jquery'), null, true); wp_enqueue_style('swiperslider-scrollbar-style', get_template_directory_uri() . '/js/swiper/idangerous.swiper.scrollbar.css', array(), null); wp_enqueue_script('swiperslider-scrollbar', get_template_directory_uri() . '/js/swiper/idangerous.swiper.scrollbar-2.1.js', array('jquery'), null, true); // wp_enqueue_style( 'swiperslider-3dflow-style', get_template_directory_uri() . '/js/swiper/idangerous.swiper.3dflow.css', array(), null ); // wp_enqueue_script( 'swiperslider-3dflow', get_template_directory_uri() . '/js/swiper/idangerous.swiper.3dflow.js', array('jquery'), null, true ); global $wp_styles; $wp_styles->done[] = 'mediaelement'; $wp_styles->done[] = 'wp-mediaelement'; wp_enqueue_style('mediaplayer-style', themerex_get_file_url('/js/mediaplayer/mediaplayer.css'), array(), null); // WP already include Media Element Library if (floatval(get_bloginfo('version')) < "3.6") { wp_enqueue_script('mediaplayer', themerex_get_file_url('/js/mediaplayer/mediaelement.min.js'), array(), null, true); } else { wp_enqueue_script('mediaelement'); } //wp_enqueue_style( 'scrollbar-style', get_template_directory_uri() . '/js/scroll/scroll.css', array(), null ); //wp_enqueue_script( 'scrollbar', get_template_directory_uri() . '/js/scroll/jquery.mCustomScrollbar.concat.min.js', array(), null, true ); wp_enqueue_script('hover-dir', get_template_directory_uri() . '/js/hover/jquery.hoverdir.js', array(), null, true); wp_enqueue_script('hover-intent', get_template_directory_uri() . '/js/hover/hoverIntent.js', array(), null, true); wp_enqueue_script('isotope', get_template_directory_uri() . '/js/jquery.isotope.min.js', array(), null, true); // wp_enqueue_script( 'elastislide-modernizr', get_template_directory_uri() . '/js/elastislide/modernizr.custom.17475.js', array(), null, true ); // wp_enqueue_script( 'elastislide-querypp', get_template_directory_uri() . '/js/elastislide/jquerypp.custom.js', array(), null, true ); // wp_enqueue_script( 'elastislide', get_template_directory_uri() . '/js/elastislide/jquery.elastislide.js', array(), null, true ); //wp_enqueue_script( 'smooth-scroll', get_template_directory_uri() . '/js/SmoothScroll.js', array(), null, true ); wp_enqueue_script('diagram-chart', get_template_directory_uri() . '/js/diagram/chart.min.js', array(), null, true); wp_enqueue_script('diagram-raphael', get_template_directory_uri() . '/js/diagram/diagram.raphael.js', array(), null, true); if (is_singular() && get_theme_option('show_share') == 'yes') { wp_enqueue_script('social-share', get_template_directory_uri() . '/js/social/social-share.js', array(), null, true); } if (get_custom_option('show_login') == 'yes') { wp_enqueue_script('form-login', get_template_directory_uri() . '/js/_form_login.js', array(), null, true); } if (is_singular() && comments_open() && get_option('thread_comments')) { wp_enqueue_script('comment-reply', false, array(), null, true); wp_enqueue_script('form-comments', get_template_directory_uri() . '/js/_form_comments.js', array(), null, true); } if (get_theme_option('show_theme_customizer') == 'yes') { wp_enqueue_script('jquery-ui-draggable', false, array('jquery', 'jquery-ui-core'), null, true); wp_enqueue_script('_customizer', get_template_directory_uri() . '/js/_customizer.js', array(), null, true); } wp_enqueue_style('messages-style', get_template_directory_uri() . '/js/messages/_messages.css', array('main-style'), null); wp_enqueue_script('messages', get_template_directory_uri() . '/js/messages/_messages.js', array(), null, true); wp_enqueue_script('knob', get_template_directory_uri() . '/js/jquery.knob.js', array(), null, true); wp_enqueue_script('jquery-ui-slider'); if (function_exists('awesome_weather_wp_head')) { wp_deregister_style('awesome-weather'); } }
function themerex_scripts() { global $wp_styles, $concatenate_scripts; $concatenate_scripts = false; // Enqueue styles //----------------------------------------------------------------------------------------------------- $fonts = getThemeFontsList(false); $theme_fonts = array(); // Prepare custom fonts if (get_custom_option('typography_custom') == 'yes') { $selectors = array('p', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6'); foreach ($selectors as $s) { $font = get_custom_option('typography_' . $s . '_font'); if (!empty($font)) { $theme_fonts[$font] = 1; } } } // Prepare current skin fonts $theme_fonts = apply_filters('theme_skin_use_fonts', $theme_fonts); // Link to selected fonts foreach ($theme_fonts as $font => $v) { if (isset($fonts[$font])) { $font_name = ($pos = themerex_strpos($font, ' (')) !== false ? themerex_substr($font, 0, $pos) : $font; $css = !empty($fonts[$font]['css']) ? $fonts[$font]['css'] : 'http://fonts.googleapis.com/css?family=' . (!empty($fonts[$font]['link']) ? $fonts[$font]['link'] : str_replace(' ', '+', $font_name) . ':100,100italic,300,300italic,400,400italic,700,700italic') . '&subset=latin,latin-ext,cyrillic,cyrillic-ext'; themerex_enqueue_style('theme-font-' . str_replace(' ', '-', $font_name), $css, array(), null); } } // Fontello styles must be loaded before main stylesheet themerex_enqueue_style('fontello', themerex_get_file_url('/css/fontello/css/fontello.css'), array(), null); themerex_enqueue_style('animation', themerex_get_file_url('/css/fontello/css/animation.css'), array(), null); // Main stylesheet themerex_enqueue_style('main-style', get_stylesheet_uri(), array(), null); // WooCommerce customizer if (function_exists('is_woocommerce')) { themerex_enqueue_style('woo-style', themerex_get_file_url('/css/woo-style.css'), array('main-style'), null); } // Tribe Events if (class_exists('TribeEvents')) { $wp_styles->done[] = 'tribe-events-custom-jquery-styles'; themerex_enqueue_style('tribe-style', themerex_get_file_url('/css/tribe-style.css'), array('main-style'), null); } // BuddyPress customizer if (class_exists('BuddyPress')) { themerex_enqueue_style('buddy-style', themerex_get_file_url('/css/buddy-style.css'), array('main-style'), null); } // BB Press customizer if (class_exists('bbPress')) { themerex_enqueue_style('bbpress-style', themerex_get_file_url('/css/bbpress-style.css'), array('main-style'), null); } // Messages themerex_enqueue_style('messages-style', themerex_get_file_url('/js/messages/_messages.css'), array('main-style'), null); // Shortcodes themerex_enqueue_style('shortcodes', themerex_get_file_url('/shortcodes/shortcodes.css'), array('main-style'), null); // Main slider if (get_custom_option('slider_show') == 'yes') { themerex_enqueue_style('swiperslider-style', themerex_get_file_url('/js/swiper/idangerous.swiper.css'), array(), null); themerex_enqueue_style('swiperslider-scrollbar-style', themerex_get_file_url('/js/swiper/idangerous.swiper.scrollbar.css'), array(), null); themerex_enqueue_style('main-slider-style', themerex_get_file_url('/css/slider-style.css'), array(), null); themerex_enqueue_script('swiperslider', themerex_get_file_url('/js/swiper/idangerous.swiper-2.7.js'), array('jquery'), null, true); themerex_enqueue_script('swiperslider-scrollbar', themerex_get_file_url('/js/swiper/idangerous.swiper.scrollbar-2.4.js'), array('jquery'), null, true); themerex_enqueue_script('flexslider', themerex_get_file_url('/js/jquery.flexslider.min.js'), array('jquery'), null, true); } // Theme skin stylesheet do_action('theme_skin_add_stylesheets'); // Custom fonts and colors if (get_custom_option('theme_skin') != '') { wp_add_inline_style('theme-skin', prepareThemeCustomStyles()); } else { wp_add_inline_style('shortcodes', prepareThemeCustomStyles()); } // Responsive if (get_theme_option('responsive_layouts') == 'yes') { themerex_enqueue_style('responsive', themerex_get_file_url('/css/responsive.css'), array('main-style'), null); do_action('theme_skin_add_responsive'); if (get_custom_option('theme_skin') != '') { $css = apply_filters('theme_skin_add_responsive_inline', ''); if (!empty($css)) { wp_add_inline_style('responsive', $css); } } } // Enqueue scripts //---------------------------------------------------------------------------------------------------------------------------- themerex_enqueue_script('jquery', false, array(), null, true); themerex_enqueue_script('jquery-ui-core', false, array(), null, true); themerex_enqueue_script('jquery-ui-tabs', false, array('jquery', 'jquery-ui-core'), null, true); themerex_enqueue_script('jquery-effects-core', false, array(), null, true); themerex_enqueue_script('jquery-effects-fade', false, array('jquery', 'jquery-effects-core'), null, true); // Load separate theme scripts themerex_enqueue_script('jquery-cookie', themerex_get_file_url('/js/jquery.cookie.js'), array('jquery'), null, true); themerex_enqueue_script('jquery-easing', themerex_get_file_url('/js/jquery.easing.js'), array('jquery'), null, true); themerex_enqueue_script('superfish', themerex_get_file_url('/js/superfish.min.js'), array('jquery'), null, true); themerex_enqueue_script('formstyler', themerex_get_file_url('/js/form_styler/jquery.formstyler.js'), array(), null, true); themerex_enqueue_script('messages', themerex_get_file_url('/js/messages/_messages.js'), array(), null, true); themerex_enqueue_script('smooth-scroll', themerex_get_file_url('/js/SmoothScroll.min.js'), array('jquery'), null, true); themerex_enqueue_script('shortcodes-init', themerex_get_file_url('/shortcodes/shortcodes_init.js'), array(), null, true); themerex_enqueue_script('_utils', themerex_get_file_url('/js/_utils.js'), array(), null, true); themerex_enqueue_script('_front', themerex_get_file_url('/js/_front.js'), array(), null, true); // Chop slider if (file_exists(themerex_get_file_dir('/js/chopslider/jquery.id.chopslider-2.0.0.free.min.js'))) { themerex_enqueue_script('chopslider', themerex_get_file_url('/js/chopslider/jquery.id.chopslider-2.0.0.free.min.js'), array('jquery'), null, true); themerex_enqueue_script('cstransitions', themerex_get_file_url('/js/chopslider/jquery.id.cstransitions-1.0.min.js'), array('jquery'), null, true); } // Video background if (get_custom_option('show_video_bg') == 'yes') { // Media elements library if (get_theme_option('use_mediaelement') == 'yes') { if (floatval(get_bloginfo('version')) < "3.6") { themerex_enqueue_style('mediaplayer-style', themerex_get_file_url('/js/mediaplayer/mediaplayer.css'), array(), null); themerex_enqueue_script('mediaplayer', themerex_get_file_url('/js/mediaplayer/mediaelement.min.js'), array(), null, true); } else { wp_enqueue_style('mediaelement'); wp_enqueue_style('wp-mediaelement'); wp_enqueue_script('mediaelement'); wp_enqueue_script('wp-mediaelement'); } } else { global $wp_scripts; $wp_scripts->done[] = 'mediaelement'; $wp_scripts->done[] = 'wp-mediaelement'; $wp_styles->done[] = 'mediaelement'; $wp_styles->done[] = 'wp-mediaelement'; } } if (get_custom_option('show_video_bg') == 'yes' && get_custom_option('video_bg_youtube_code') != '') { themerex_enqueue_script('video-bg', themerex_get_file_url('/js/jquery.tubular.1.0.js'), array('jquery'), null, true); } // Google map if (get_custom_option('googlemap_show') == 'yes') { themerex_enqueue_script('googlemap', 'http://maps.google.com/maps/api/js?sensor=false', array(), null, true); themerex_enqueue_script('googlemap_init', themerex_get_file_url('/js/_googlemap_init.js'), array(), null, true); } // Theme skin script do_action('theme_skin_add_scripts'); }