Exemplo n.º 1
0
 /**
  * Front-end styles
  */
 public function styles()
 {
     if (is_admin() || WpvTemplates::is_login()) {
         return;
     }
     $theme_version = WpvFramework::get_version();
     $external_fonts = maybe_unserialize(wpv_get_option('external-fonts'));
     if (is_array($external_fonts) && !empty($external_fonts)) {
         foreach ($external_fonts as $name => $url) {
             wp_enqueue_style('wpv-' . $name, $url, array(), $theme_version);
         }
     }
     wp_enqueue_style('front-magnific-popup', wpv_prepare_url(WPV_THEME_CSS . 'magnific.css'));
     $cache_timestamp = wpv_get_option('css-cache-timestamp');
     $generated_deps = array('front-magnific-popup');
     if (wpv_has_woocommerce()) {
         $generated_deps[] = 'woocommerce-layout';
         $generated_deps[] = 'woocommerce-smallscreen';
         $generated_deps[] = 'woocommerce-general';
     }
     if (class_exists('Tribe__Events__Main') && (tribe_is_event_query() || tribe_is_event_organizer() || tribe_is_event_venue())) {
         $generated_deps[] = 'tribe-events-calendar-style';
         $generated_deps[] = 'tribe-events-full-calendar-style';
     }
     $suffix = is_multisite() ? $GLOBALS['blog_id'] : '';
     $css_file = 'all' . $suffix . '.css';
     $css_path = WPV_CACHE_URI . $css_file;
     if (!file_exists(WPV_CACHE_DIR . $css_file)) {
         $css_path = WPV_SAMPLES_URI . 'all-default.css';
     }
     wp_enqueue_style('front-all', wpv_prepare_url($css_path), $generated_deps, $cache_timestamp);
     global $wpv_is_shortcode_preview;
     if ($wpv_is_shortcode_preview) {
         wp_enqueue_style('vamtam-shortcode-preview', WPV_ADMIN_ASSETS_URI . 'css/shortcode-preview.css');
     }
     $custom_icons = get_option('vamtam-custom-icons-map');
     if ($custom_icons) {
         $icons_path = trailingslashit(WP_CONTENT_URL) . 'vamtam/custom-icon-font/';
         $custom_icons_css = "\n\t\t\t\t@font-face {\n\t\t\t\t\tfont-family: 'vamtam-custom-icons';\n\t\t\t\t\tsrc: url({$icons_path}custom-icons.eot);\n\t\t\t\t\tsrc: url({$icons_path}custom-icons.eot?#iefix) format('embedded-opentype'),\n\t\t\t\t\t\turl({$icons_path}custom-icons.ttf) format('truetype');\n\t\t\t\t\tfont-weight: normal;\n\t\t\t\t\tfont-style: normal;\n\t\t\t\t}\n\t\t\t";
         wp_add_inline_style('front-all', $custom_icons_css);
     }
 }