/** * Load custom CSS file for tweaks * * @since 2.0.0 * @access public */ public function load_custom_stylesheet() { if (function_exists('wpex_active_skin')) { $skin = wpex_active_skin(); if ('base' == $skin) { wp_enqueue_style('wpex-tribe-events', WPEX_CSS_DIR_URI . 'wpex-tribe-events.css'); } } }
function wpex_active_skin_class_file() { // Get active skin $active_skin = wpex_active_skin(); // Lets bail if the active skin is the base skin if ('base' == $active_skin || !$active_skin) { return; } // Get currect skin class to load later $skins = wpex_skins(); $active_skin_array = wp_array_slice_assoc($skins, array($active_skin)); if (is_array($active_skin_array)) { $is_core = !empty($active_skin_array[$active_skin]['core']) ? true : false; $class_file = !empty($active_skin_array[$active_skin]['class']) ? $active_skin_array[$active_skin]['class'] : false; } // Return class file if one exists if ($is_core && $class_file) { return $class_file; } }
function wpex_body_classes($classes) { // Get post ID $post_id = wpex_get_the_id(); // Define main layout style $main_layout = wpex_main_layout($post_id); // WPExplorer class $classes[] = 'wpex-theme'; // Responsive if (get_theme_mod('responsive', 'on')) { $classes[] = 'wpex-responsive'; } // Add skin to body classes if (function_exists('wpex_active_skin') && wpex_active_skin()) { $classes[] = 'theme-' . wpex_active_skin(); } // Check if the Visual Composer is being used on this page if (function_exists('wpex_post_has_composer') && wpex_post_has_composer($post_id)) { $classes[] = 'has-composer'; } // Meta Options if ($post_id) { // No header margin if ('on' == get_post_meta($post_id, 'wpex_disable_header_margin', true)) { $classes[] = 'no-header-margin'; } // Slider if (wpex_post_slider_shortcode($post_id)) { $classes[] = 'page-with-slider'; } // Title with Background Image if ('background-image' == get_post_meta($post_id, 'wpex_post_title_style', true)) { $classes[] = 'page-with-background-title'; } } // Layout Style $classes[] = $main_layout . '-main-layout'; // Boxed Layout dropshadow if ('boxed' == $main_layout && get_theme_mod('boxed_dropdshadow')) { $classes[] = 'wrap-boxshadow'; } // Content layout if (function_exists('wpex_get_post_layout_class')) { $classes[] = 'content-' . wpex_get_post_layout_class($post_id); } // Single Post cagegories if (is_singular('post')) { $cats = get_the_category($post_id); foreach ($cats as $cat) { $classes[] = 'post-in-category-' . $cat->category_nicename; } } // Breadcrumbs if (function_exists('wpex_breadcrumbs_enabled') && wpex_breadcrumbs_enabled() && 'default' == get_theme_mod('breadcrumbs_position', 'default')) { $classes[] = 'has-breadcrumbs'; } // Shrink fixed header if (get_theme_mod('shink_fixed_header', '1') && 'one' == get_theme_mod('header_style', 'one')) { $classes[] = 'shrink-fixed-header'; } // WooCommerce if (class_exists('Woocommerce') && is_shop()) { if (get_theme_mod('woo_shop_slider')) { $classes[] = 'page-with-slider'; } if (!get_theme_mod('woo_shop_title', '1')) { $classes[] = 'page-without-title'; } } // Widget Icons if (get_theme_mod('widget_icons', 'on')) { $classes[] = 'sidebar-widget-icons'; } // Mobile if (wp_is_mobile()) { $classes[] = 'is-mobile'; } // Overlay header style if (function_exists('wpex_is_overlay_header_enabled') && wpex_is_overlay_header_enabled($post_id)) { $classes[] = 'has-overlay-header'; } // Footer reveal if (function_exists('wpex_footer_reveal_enabled') && wpex_footer_reveal_enabled($post_id)) { $classes[] = 'footer-has-reveal'; } return $classes; }
function wpex_body_classes($classes) { // WPExplorer class $classes[] = 'wpex-theme'; // Responsive $responsive = wpex_option('responsive', '1'); if ($responsive == '1') { $classes[] = 'wpex-responsive'; } // Add skin to body classes if (function_exists('wpex_active_skin')) { $site_theme = wpex_active_skin(); if ($site_theme) { $classes[] = 'theme-' . $site_theme; } } // Page with Slider or header if (is_singular()) { global $post; $post_id = $post->ID; $slider = get_post_meta($post_id, 'wpex_post_slider_shortcode', true); $title_style = get_post_meta($post_id, 'wpex_post_title_style', true); if ($slider) { $classes[] = 'page-with-slider'; } if ($title_style == 'background-image') { $classes[] = 'page-with-background-title'; } } // Layout Style if (is_singular()) { global $post; $meta = get_post_meta($post->ID, 'wpex_main_layout', true); if ($meta == 'boxed') { $classes[] = $meta . '-main-layout'; } else { $classes[] = wpex_option('main_layout_style', 'full-width') . '-main-layout'; } } else { $classes[] = wpex_option('main_layout_style', 'full-width') . '-main-layout'; } // Remove header bottom margin if (is_singular()) { global $post; $disable_header_margin = get_post_meta($post->ID, 'wpex_disable_header_margin', true); if ('on' == $disable_header_margin) { $classes[] = 'no-header-margin'; } } // Check if breadcrumbs are enabled if (function_exists('wpex_breadcrumbs_enabled')) { if (wpex_breadcrumbs_enabled() && 'default' == wpex_option('breadcrumbs_position', 'default')) { $classes[] = 'has-breadcrumbs'; } } // Shrink fixed header if (wpex_option('shink_fixed_header', '1') && 'one' == wpex_option('header_style', '1')) { $classes[] = 'shrink-fixed-header'; } // Single Post cagegories if (is_singular('post')) { global $post; $cats = get_the_category($post->ID); foreach ($cats as $c) { $classes[] = 'post-in-category-' . $c->category_nicename; } } // WooCommerce if (class_exists('Woocommerce')) { if (wpex_option('woo_shop_slider') !== '' && is_shop()) { $classes[] = 'page-with-slider'; } if (wpex_option('woo_shop_title', '1') !== '1' && is_shop()) { $classes[] = 'page-without-title'; } } // Widget Icons if (wpex_option('widget_icons', '1') == '1') { $classes[] = 'sidebar-widget-icons'; } // Mobile if (wp_is_mobile()) { $classes[] = 'is-mobile'; } return $classes; }
/** * Settings page output */ public function create_admin_page() { ?> <div class="wrap wpex-skins-admin"> <h2>Theme Skins</h2> <?php // Check if admin is enabled $notice = apply_filters('wpex_skins_deprecated_notice', true); // Display notice if ($notice) { ?> <div class="notice error" style="display:block!important;padding:20px;"> <h4 style="margin:0 0 10px;font-size:16px;">Important Notice</h4> <p>Skins have been deprecated since Total 3.0.0. The theme has enough settings to allow you to create a design that fits your needs without loading extra bloat. If you select the "base" skin this admin panel will be removed and you will see an error message. To re-enable please visit the online snippets for this theme.</p> <p>We highly recommend you select the BASE skin and make all your edits via the Customizer to get the design you want or use a child theme (both are more optimized methods).</p> </div> <?php } // Get skins array $skins = WPEX_Skin_Loader::skins_array(); // Current skin from site_theme option $current_skin = wpex_active_skin(); // Get fallback from redux if (!$current_skin) { $data = get_option('wpex_options'); $current_skin = isset($data['site_theme']) ? $data['site_theme'] : 'base'; } ?> <form method="post" action="options.php"> <?php settings_fields('wpex_skins_options'); ?> <div class="wpex-skins-select theme-browser" id="theme_skin"> <?php // Loop through skins foreach ($skins as $key => $val) { $classes = 'wpex-skin theme'; $checked = $active = ''; if (!empty($current_skin) && $current_skin == $key) { $checked = 'checked'; $classes .= ' active'; } ?> <div class="<?php echo $classes; ?> "> <input type="radio" id="wpex-skin-<?php echo $key; ?> " name="theme_skin" value="<?php echo $key; ?> " <?php echo $checked; ?> class="wpex-skin-radio" /> <?php if (!empty($val['screenshot'])) { ?> <div class="theme-screenshot"> <img src="<?php echo esc_url($val['screenshot']); ?> " alt="Screenshot" /> </div> <?php } elseif (function_exists('wpex_placeholder_img_src')) { ?> <div class="theme-screenshot"> <img src="<?php echo wpex_placeholder_img_src(); ?> " /> </div> <?php } ?> <h3 class="theme-name"> <?php if ('active' == $active) { echo '<strong>Active:</strong> '; } ?> <?php echo $val['name']; ?> </h3> </div> <?php } ?> </div><!-- .wpex-skin --> <?php submit_button(); ?> </form> </div><!-- .wpex-skins-select --> <script type="text/javascript"> ( function($) { "use strict"; $( '.wpex-skin' ).click( function() { $( '.wpex-skin' ).removeClass( 'active' ); $( this ).addClass( 'active' ); var radio = $(this).find( '.wpex-skin-radio' ); radio.prop( 'checked', true ); event.preventDefault(); } ); } ) ( jQuery ); </script> <?php }
function wpex_responsive_widths() { // Vars $css = $add_css = ''; /*-----------------------------------------------------------------------------------*/ /* - Desktop Width /*-----------------------------------------------------------------------------------*/ // Main Container With if (($width = get_theme_mod('main_container_width', '980px')) && '980px' != $width) { if ('gaps' == wpex_active_skin()) { $add_css .= '.is-sticky .fixed-nav,#wrap{width:' . $width . '!important;}'; } else { $add_css .= '.container,.vc_row-fluid.container,.boxed-main-layout #wrap,.boxed-main-layout .is-sticky #site-header,.boxed-main-layout .is-sticky .fixed-nav { width: ' . $width . ' !important; }'; } } // Left container width if (($width = get_theme_mod('left_container_width', '680px')) && $width != '680px') { $add_css .= '.content-area{width:' . $width . ';}'; } // Sidebar width if (($width = get_theme_mod('sidebar_width', '250px')) && '250px' != $width) { $add_css .= '#sidebar{width: ' . $width . ';}'; } // Add to $css var if ($add_css) { $css .= '@media only screen and (min-width: 1281px){' . $add_css . '}'; $add_css = ''; } /*-----------------------------------------------------------------------------------*/ /* - Tablet Landscape & Small Screen Widths /*-----------------------------------------------------------------------------------*/ // Main Container With if (($width = get_theme_mod('tablet_landscape_main_container_width', '980px')) && '980px' != $width) { if ('gaps' == wpex_active_skin()) { $add_css .= '.is-sticky .fixed-nav,#wrap{width:' . $width . '!important;}'; } else { $add_css .= '.container,.vc_row-fluid.container,.boxed-main-layout #wrap,.boxed-main-layout .is-sticky #site-header,.boxed-main-layout .is-sticky .fixed-nav { width: ' . $width . ' !important; }'; } } // Left container width if (($width = get_theme_mod('tablet_landscape_left_container_width', '680px')) && $width != '680px') { $add_css .= '.content-area{width:' . $width . ';}'; } // Sidebar width if (($width = get_theme_mod('tablet_landscape_sidebar_width', '250px')) && '250px' != $width) { $add_css .= '#sidebar{width: ' . $width . ';}'; } // Add to $css var if ($add_css) { $css .= '@media only screen and (min-width: 960px) and (max-width: 1280px){' . $add_css . '}'; $add_css = ''; } /*-----------------------------------------------------------------------------------*/ /* - Tablet Widths /*-----------------------------------------------------------------------------------*/ // Main Container With if (($width = get_theme_mod('tablet_main_container_width', '700px')) && '700px' != $width) { if ('gaps' == wpex_active_skin()) { $add_css .= '.is-sticky .fixed-nav,#wrap{width:' . $width . '!important;}'; } else { $add_css .= '.container,.vc_row-fluid.container,.boxed-main-layout #wrap,.boxed-main-layout .is-sticky #site-header,.boxed-main-layout .is-sticky .fixed-nav { width: ' . $width . ' !important; }'; } } // Left container width if (($width = get_theme_mod('tablet_left_container_width', '100%')) && $width != '100%') { $add_css .= '.content-area{width:' . $width . ';}'; } // Sidebar width if (($width = get_theme_mod('tablet_sidebar_width', '100%')) && '100%' != $width) { $add_css .= '#sidebar{width: ' . $width . ';}'; } // Add to $css var if ($add_css) { $css .= '@media only screen and (min-width: 768px) and (max-width: 959px){' . $add_css . '}'; $add_css = ''; } /*-----------------------------------------------------------------------------------*/ /* - Phone Widths /*-----------------------------------------------------------------------------------*/ // Phone Portrait $mobile_portrait_main_container_width = get_theme_mod('mobile_portrait_main_container_width'); if ($mobile_portrait_main_container_width && '90%' != $mobile_portrait_main_container_width) { $css .= '@media only screen and (max-width: 767px) { .container { width: ' . $mobile_portrait_main_container_width . ' !important; min-width: 0; } }'; } // Phone Landscape $mobile_landscape_main_container_width = get_theme_mod('mobile_landscape_main_container_width'); if ($mobile_landscape_main_container_width && '90%' != $mobile_landscape_main_container_width) { $css .= '@media only screen and (min-width: 480px) and (max-width: 767px) { .container { width: ' . $mobile_landscape_main_container_width . ' !important; } }'; } // Return custom CSS if ('' != $css && !empty($css)) { $css = '/*RESPONSIVE WIDTHS START*/' . $css; return $css; } }
/** * Returns correct theme skin * * @since 3.0.0 */ private function skin() { if (function_exists('wpex_active_skin')) { return wpex_active_skin(); } }