/** * Enqueue scripts and styles. */ function presscore_enqueue_scripts() { global $wp_styles; // enqueue web fonts if needed presscore_enqueue_web_fonts(); $theme_version = wp_get_theme()->get('Version'); $template_directory = PRESSCORE_THEME_DIR; $template_uri = PRESSCORE_THEME_URI; presscore_enqueue_theme_stylesheet('dt-main', 'css/main'); presscore_enqueue_theme_stylesheet('dt-old-ie', 'css/old-ie'); $wp_styles->add_data('dt-old-ie', 'conditional', 'lt IE 10'); presscore_enqueue_theme_stylesheet('dt-awsome-fonts', 'fonts/FontAwesome/css/font-awesome'); if (locate_template('fonts/fontello/css/fontello.css', false)) { presscore_enqueue_theme_stylesheet('dt-fontello', 'fonts/fontello/css/fontello'); } presscore_enqueue_dynamic_stylesheets(); $wp_styles->add_data('dt-custom-old-ie.less', 'conditional', 'lt IE 10'); $config = Presscore_Config::get_instance(); if ('slideshow' == $config->get('header_title') && '3d' == $config->get('slideshow_mode')) { presscore_enqueue_theme_stylesheet('dt-3d-slider', 'css/compatibility/3D-slider'); } wp_enqueue_style('style', get_stylesheet_uri(), array(), $theme_version); presscore_enqueue_theme_script('dt-above-fold', 'js/above-the-fold', array('jquery'), $theme_version, false); // detect device type $detect = new Mobile_Detect(); $device_type = $detect->isMobile() ? $detect->isTablet() ? 'tablet' : 'phone' : 'computer'; presscore_enqueue_theme_script('dt-main', 'js/main', array('jquery'), $theme_version, true); $config->set('device_type', $device_type); if (is_page()) { $page_data = array('type' => 'page', 'template' => $config->get('template'), 'layout' => $config->get('justified_grid') ? 'jgrid' : $config->get('layout')); } else { if (is_archive()) { $page_data = array('type' => 'archive', 'template' => $config->get('template'), 'layout' => $config->get('justified_grid') ? 'jgrid' : $config->get('layout')); } else { if (is_search()) { $page_data = array('type' => 'search', 'template' => $config->get('template'), 'layout' => $config->get('justified_grid') ? 'jgrid' : $config->get('layout')); } else { $page_data = false; } } } global $post; $dt_local = array('passText' => __('To view this protected post, enter the password below:', 'the7mk2'), 'moreButtonText' => array('loading' => __('Loading...', 'the7mk2')), 'postID' => empty($post->ID) ? null : $post->ID, 'ajaxurl' => esc_url(admin_url('admin-ajax.php')), 'contactNonce' => wp_create_nonce('dt_contact_form'), 'ajaxNonce' => wp_create_nonce('presscore-posts-ajax'), 'pageData' => $page_data, 'themeSettings' => array('smoothScroll' => of_get_option('general-smooth_scroll', 'on'), 'lazyLoading' => 'lazy_loading' === $config->get('load_style'), 'accentColor' => array(), 'floatingHeader' => array('showAfter' => $config->get('header.floating_navigation.show_after'), 'showMenu' => dt_sanitize_flag($config->get('header.floating_navigation.enabled')), 'height' => of_get_option('header-floating_navigation-height')), 'mobileHeader' => array('firstSwitchPoint' => of_get_option('header-mobile-first_switch-after', 1024), 'secondSwitchPoint' => of_get_option('header-mobile-second_switch-after', 200)), 'content' => array('responsivenessTreshold' => of_get_option('general-responsiveness-treshold', 800), 'textColor' => of_get_option('content-primary_text_color', '#000000'), 'headerColor' => of_get_option('content-headers_color', '#000000')), 'stripes' => array('stripe1' => array('textColor' => of_get_option('stripes-stripe_1_text_color', '#000000'), 'headerColor' => of_get_option('stripes-stripe_1_headers_color', '#000000')), 'stripe2' => array('textColor' => of_get_option('stripes-stripe_2_text_color', '#000000'), 'headerColor' => of_get_option('stripes-stripe_2_headers_color', '#000000')), 'stripe3' => array('textColor' => of_get_option('stripes-stripe_3_text_color', '#000000'), 'headerColor' => of_get_option('stripes-stripe_3_headers_color', '#000000'))))); // floating menu $logo = presscore_get_logo_src(presscore_get_floating_menu_logos_meta()); $dt_local['themeSettings']['floatingHeader']['logo'] = array('showLogo' => 'none' !== $config->get('header.floating_navigation.logo.style'), 'src' => empty($logo[0]) ? '' : $logo[0], 'w' => empty($logo[1]) ? '' : $logo[1], 'h' => empty($logo[2]) ? '' : $logo[2]); switch ($config->get('template.accent.color.mode')) { case 'gradient': $dt_local['themeSettings']['accentColor']['mode'] = 'gradient'; $dt_local['themeSettings']['accentColor']['color'] = of_get_option('general-accent_bg_color_gradient', array('#000000', '#000000')); break; case 'color': default: $dt_local['themeSettings']['accentColor']['mode'] = 'solid'; $dt_local['themeSettings']['accentColor']['color'] = of_get_option('general-accent_bg_color', '#000000'); } $dt_local = apply_filters('presscore_localized_script', $dt_local); // add some additional data wp_localize_script('dt-above-fold', 'dtLocal', $dt_local); // comments clear script if (is_singular() && comments_open() && get_option('thread_comments')) { wp_enqueue_script('comment-reply'); } $custom_css = of_get_option('general-custom_css', ''); if ($custom_css) { wp_add_inline_style('style', $custom_css); } }
/** * Returns mixed header classes as array. * * @since 3.0.0 * @param string|array $class * @return array */ function presscore_get_mixed_header_class($class = '') { $classes = presscore_split_classes($class); $config = presscore_config(); switch ($config->get('header.mixed.view')) { case 'side_line': $classes[] = 'side-header-v-stroke'; break; case 'top_line': $classes[] = 'side-header-h-stroke'; if (dt_sanitize_flag($config->get('header.mixed.view.top_line.is_fullwidth'))) { $classes[] = 'full-width'; } $logo_pos = $config->get('header.mixed.view.top_line.logo.position'); if ('center' == $logo_pos) { $classes[] = 'logo-center'; } else { if ('left' == $logo_pos) { $classes[] = 'logo-left'; } else { if ('right' == $logo_pos) { $classes[] = 'logo-right'; } } } break; case 'menu_icon': default: $classes[] = 'side-header-menu-icon'; if (dt_sanitize_flag($config->get('header.mixed.view.menu_icon.floating_logo.enabled'))) { $classes[] = 'floating-logo'; } break; } $classes[] = presscore_header_get_decoration_class($config->get('header.mixed.decoration')); $classes = apply_filters('presscore_mixed_header_class', $classes, $class); return presscore_sanitize_classes($classes); }