/** * Localize scripts * * @since 2.1.0 */ public function localize($array) { // Add lightbox settings to array $array['iLightbox'] = array('skin' => wpex_global_obj('lightbox_skin'), 'path' => 'horizontal', 'controls' => array('arrows' => wpex_get_mod('lightbox_arrows', true), 'thumbnail' => wpex_get_mod('lightbox_thumbnails', true), 'fullscreen' => wpex_get_mod('lightbox_fullscreen', true), 'mousewheel' => wpex_get_mod('lightbox_mousewheel', false)), 'effects' => array('loadedFadeSpeed' => 50, 'fadeSpeed' => 500), 'show' => array('title' => wpex_get_mod('lightbox_titles', true), 'speed' => 200), 'hide' => array('speed' => 200), 'overlay' => array('blur' => true, 'opacity' => 0.9), 'social' => array('start' => true, 'show' => 'mouseenter', 'hide' => 'mouseleave', 'buttons' => false)); // Return array return $array; }
/** * Generates the CSS output * * @since 2.0.0 */ public static function generate($output) { // Define main variables $css = ''; // Fix for Fonts In the Visual Composer if (wpex_global_obj('vc_is_inline')) { $css .= '.wpb_row .fa:before { box-sizing:content-box!important; -moz-box-sizing:content-box!important; -webkit-box-sizing:content-box!important; }'; } // Fixes for full-width layout when custom background is added if ('full-width' == wpex_global_obj('main_layout') && (wpex_get_mod('background_color') || wpex_get_mod('background_image'))) { $css .= '.wpex-sticky-header-holder{background:none;}'; } // Remove header border if custom color is set if (wpex_get_mod('header_background')) { $css .= '.is-sticky #site-header{border-color:transparent;}'; } // Overlay Header font size if (wpex_global_obj('has_overlay_header') && ($font_size = get_post_meta(wpex_global_obj('post_id'), 'wpex_overlay_header_font_size', true))) { $css .= '#site-navigation, #site-navigation .dropdown-menu a{font-size:' . intval($font_size) . 'px;}'; } /*-----------------------------------------------------------------------------------*/ /* - Return CSS /*-----------------------------------------------------------------------------------*/ if (!empty($css)) { $output .= '/*ADVANCED STYLING CSS*/' . $css; } // Return output css return $output; }
function display_element($element, &$children_elements, $max_depth, $depth = 0, $args, &$output) { // Define vars $id_field = $this->db_fields['id']; $header_style = wpex_global_obj('header_style'); // Down Arrows if (!empty($children_elements[$element->{$id_field}]) && $depth == 0) { $element->classes[] = 'dropdown'; if (wpex_get_mod('menu_arrow_down')) { $arrow_class = 'six' == $header_style ? 'fa-chevron-right' : 'fa-angle-down'; $element->title .= ' <span class="nav-arrow top-level fa ' . $arrow_class . '"></span>'; } } // Right/Left Arrows if (!empty($children_elements[$element->{$id_field}]) && $depth > 0) { $element->classes[] = 'dropdown'; if (wpex_get_mod('menu_arrow_side', true)) { if (is_rtl()) { $element->title .= '<span class="nav-arrow second-level fa fa-angle-left"></span>'; } else { $element->title .= '<span class="nav-arrow second-level fa fa-angle-right"></span>'; } } } // Remove current menu item when using local-scroll class if (in_array('local-scroll', $element->classes) && in_array('current-menu-item', $element->classes)) { $key = array_search('current-menu-item', $element->classes); unset($element->classes[$key]); } // Define walker Walker_Nav_Menu::display_element($element, $children_elements, $max_depth, $depth, $args, $output); }
/** * Generates the CSS output * * @since 2.0.0 */ public static function generate($output) { // Define main variables $css = ''; /*-----------------------------------------------------------------------------------*/ /* - Logo Max Widths /*-----------------------------------------------------------------------------------*/ // Desktop if ($width = wpex_get_mod('logo_max_width')) { $css .= '@media only screen and (min-width: 960px) { #site-logo img { max-width: ' . wpex_sanitize_data($width, 'px_pct') . '; } }'; } // Tablet Portrait if ($width = wpex_get_mod('logo_max_width_tablet_portrait')) { $css .= '@media only screen and (min-width: 768px) and (max-width: 959px) { #site-logo img { max-width: ' . wpex_sanitize_data($width, 'px_pct') . '; } }'; } // Phone if ($width = wpex_get_mod('logo_max_width_phone')) { $css .= '@media only screen and (max-width: 767px) { #site-logo img { max-width: ' . wpex_sanitize_data($width, 'px_pct') . '; } }'; } /*-----------------------------------------------------------------------------------*/ /* - Other /*-----------------------------------------------------------------------------------*/ // Fixes for full-width layout when custom background is added if ('full-width' == wpex_global_obj('main_layout') && (wpex_get_mod('background_color') || wpex_get_mod('background_image'))) { $css .= '.wpex-sticky-header-holder{background:none;}'; } // Fix for Fonts In the Visual Composer if (wpex_global_obj('vc_is_inline')) { $css .= '.wpb_row .fa:before { box-sizing:content-box!important; -moz-box-sizing:content-box!important; -webkit-box-sizing:content-box!important; }'; } // Remove header border if custom color is set if (wpex_get_mod('header_background')) { $css .= '.is-sticky #site-header{border-color:transparent;}'; } // Overlay Header font size if (wpex_global_obj('has_overlay_header') && ($font_size = get_post_meta(wpex_global_obj('post_id'), 'wpex_overlay_header_font_size', true))) { $css .= '#site-navigation, #site-navigation .dropdown-menu a{font-size:' . intval($font_size) . 'px;}'; } /*-----------------------------------------------------------------------------------*/ /* - Return CSS /*-----------------------------------------------------------------------------------*/ if (!empty($css)) { $output .= '/*ADVANCED STYLING CSS*/' . $css; } // Return output css return $output; }
/** * Convert center row into bool * * @since 2.0.2 */ private function parse_center_row($value) { if (!empty($this->atts['full_width'])) { $this->atts['center_row'] = false; } elseif ('yes' == $value && 'full-screen' == wpex_global_obj('post_layout')) { $this->atts['center_row'] = true; } else { $this->atts['center_row'] = false; } }
/** * Returns defined post layout for curent post * * @since 2.0.0 */ function wpex_get_post_layout() { // Get global object $obj = wpex_global_obj(); // Return post layout if defined if (!empty($obj->post_layout)) { return $obj->post_layout; } else { return wpex_post_layout(); } }
function wpex_wcmenucart_menu_item() { // Vars global $woocommerce; $icon_style = wpex_get_mod('woo_menu_icon_style', 'drop-down'); $custom_link = wpex_get_mod('woo_menu_icon_custom_link'); $header_style = wpex_global_obj('header_style'); // URL if ('custom-link' == $icon_style && $custom_link) { $url = esc_url($custom_link); } else { $cart_id = woocommerce_get_page_id('cart'); if (function_exists('icl_object_id')) { $cart_id = icl_object_id($cart_id, 'page'); } $url = get_permalink($cart_id); } // Cart total $display = wpex_get_mod('woo_menu_icon_display', 'icon_count'); if ('icon_total' == $display) { $cart_extra = WC()->cart->get_cart_total(); $cart_extra = str_replace('amount', 'wcmenucart-details', $cart_extra); } elseif ('icon_count' == $display) { $cart_extra = '<span class="wcmenucart-details count">' . WC()->cart->cart_contents_count . '</span>'; } else { $cart_extra = ''; } // Cart Icon $cart_icon = '<span class="fa fa-shopping-cart"></span><span class="wcmenucart-text">' . _x('Shop', 'Navbar Cart Text For Vertical Nav', 'wpex') . '</span>'; $cart_icon = apply_filters('wpex_menu_cart_icon_html', $cart_icon); ob_start(); ?> <a href="<?php echo $url; ?> " class="wcmenucart" title="<?php _e('Your Cart', 'wpex'); ?> "> <span class="link-inner"> <span class="wcmenucart-count"><?php echo $cart_icon; echo $cart_extra; ?> </span> </span> </a> <?php return ob_get_clean(); }
/** * Custom function for displaying menu styles 2 and 3 required for this skin * * @since 2.0.2 */ public function gaps_menu_two_three() { // Get current filter $filter = current_filter(); // Set bool variable $get = false; // Check current filter against header style if (in_array(wpex_global_obj('header_style'), array('two', 'three')) && 'wpex_hook_main_before' == $filter) { $get = true; } // Get menu template part if ($get) { get_template_part('partials/header/header-menu'); } }
/** * Check if search icon should be in the nav * * @since 1.0.0 */ function wpex_has_menu_search() { // Return false by default $return = false; // Get header style $header_style = wpex_global_obj('header_style'); // Always return true for the header style 2, we can hide via CSS if ('two' == $header_style) { $return = true; } elseif (wpex_get_mod('main_search', true)) { $return = true; } // Apply filters $return = apply_filters('wpex_has_menu_search', $return); // Return return $return; }
/** * Adds the search icon to the menu items * * @since 1.0.0 */ function wpex_add_search_to_menu($items, $args) { // Only used on main menu if ('main_menu' != $args->theme_location) { return $items; } // Get search style $search_style = wpex_global_obj('menu_search_style'); // Return if disabled if (!$search_style || 'disabled' == $search_style) { return $items; } // Get header style $header_style = wpex_global_obj('header_style'); // Get correct search icon class if ('overlay' == $search_style) { $class = ' search-overlay-toggle'; } elseif ('drop_down' == $search_style) { $class = ' search-dropdown-toggle'; } elseif ('header_replace' == $search_style) { $class = ' search-header-replace-toggle'; } else { $class = ''; } // Add search item to menu $items .= '<li class="search-toggle-li wpex-menu-extra">'; $items .= '<a href="#" class="site-search-toggle' . $class . '">'; $items .= '<span class="link-inner">'; $items .= '<span class="fa fa-search"></span>'; if ('six' == $header_style) { $items .= '<span class="wpex-menu-search-text">' . _x('Search', 'Navbar Search Text For Vertical Nav', 'wpex') . '</span>'; } $items .= '</span>'; $items .= '</a>'; $items .= '</li>'; // Return nav $items return $items; }
/** * Retrieves cached CSS or generates the responsive CSS * * @since 1.6.3 */ public static function get_css($output) { // Define vars $css = $add_css = ''; $main_layout = wpex_global_obj('main_layout'); $active_skin = wpex_global_obj('skin'); /*-----------------------------------------------------------------------------------*/ /* - Max Width /*-----------------------------------------------------------------------------------*/ // Max Width if ($max_width = wpex_get_mod('container_max_width', false)) { $css .= 'body.wpex-responsive .container, body.wpex-responsive .vc_row-fluid.container { max-width:' . $max_width . '; }'; } /*-----------------------------------------------------------------------------------*/ /* - Desktop Width /*-----------------------------------------------------------------------------------*/ // Main Container With if ($width = wpex_get_mod('main_container_width', false)) { if ('boxed' == $main_layout || 'gaps' == $active_skin) { $add_css .= '.boxed-main-layout #wrap { width:' . $width . '; }'; } else { $add_css .= '.container, .vc_row-fluid.container { width: ' . $width . ' !important; max-width:none; }'; } } // Left container width if ($width = wpex_get_mod('left_container_width', false)) { $add_css .= '.content-area{ width:' . $width . '; max-width:none; }'; } // Sidebar width if ($width = wpex_get_mod('sidebar_width', false)) { $add_css .= '#sidebar{ width: ' . $width . '; max-width:none; }'; } // Add to $css var if ($add_css) { $css .= $add_css; $add_css = ''; } /*-----------------------------------------------------------------------------------*/ /* - Tablet Landscape & Small Screen Widths /*-----------------------------------------------------------------------------------*/ // Main Container With if ($width = wpex_get_mod('tablet_landscape_main_container_width', false)) { if ('boxed' == $main_layout || 'gaps' == $active_skin) { $add_css .= '.boxed-main-layout #wrap{ width:' . $width . '; max-width:none; }'; } else { $add_css .= '.container, .vc_row-fluid.container { width: ' . $width . ' !important; max-width:none; }'; } } // Left container width if ($width = wpex_get_mod('tablet_landscape_left_container_width', false)) { $add_css .= '.content-area{ width:' . $width . '; max-width:none; }'; } // Sidebar width if ($width = wpex_get_mod('tablet_landscape_sidebar_width', false)) { $add_css .= '#sidebar{ width: ' . $width . '; max-width:none; }'; } // 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 = wpex_get_mod('tablet_main_container_width', false)) { if ('boxed' == $main_layout || 'gaps' == $active_skin) { $add_css .= '.boxed-main-layout #wrap{ width:' . $width . '; max-width:none; }'; } else { $add_css .= '.container, .vc_row-fluid.container { width: ' . $width . ' !important; max-width:none; }'; } } // Left container width if ($width = wpex_get_mod('tablet_left_container_width', false)) { $add_css .= '.content-area{ width:' . $width . '; }'; } // Sidebar width if ($width = wpex_get_mod('tablet_sidebar_width', false)) { $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 if ($width = wpex_get_mod('mobile_portrait_main_container_width', false)) { if ('boxed' == $main_layout || 'gaps' == $active_skin) { $css .= '@media only screen and (max-width: 767px) { .boxed-main-layout #wrap { width: ' . $width . ' !important; min-width: 0; } }'; } else { $css .= '@media only screen and (max-width: 767px) { .container { width: ' . $width . ' !important; min-width: 0; } }'; } } // Phone Landscape if ($width = wpex_get_mod('mobile_landscape_main_container_width', false)) { if ('boxed' == $main_layout || 'gaps' == $active_skin) { $css .= '@media only screen and (min-width: 480px) and (max-width: 767px) { .boxed-main-layout #wrap { width: ' . $width . ' !important; } }'; } else { $css .= '@media only screen and (min-width: 480px) and (max-width: 767px) { .container { width: ' . $width . ' !important; } }'; } } // Return custom CSS if (!empty($css)) { $css = '/*RESPONSIVE WIDTHS*/' . $css; $output .= $css; } // Return output css return $output; }
*/ // Exit if accessed directly if (!defined('ABSPATH')) { exit; } // Menu Location $menu_location = apply_filters('wpex_main_menu_location', 'main_menu'); // Multisite global menu $ms_global_menu = apply_filters('wpex_ms_global_menu', false); // Display if menu is defined if (has_nav_menu($menu_location) || $ms_global_menu) { ?> <?php // Closing toggle for the sidr mobile menu style if ('sidr' == wpex_global_obj('mobile_menu_style')) { ?> <div id="sidr-close"><a href="#sidr-close" class="toggle-sidr-close"></a></div> <?php } ?> <div id="wpex-mobile-menu-fixed-top" class="clr wpex-hidden"> <div class="container clr"> <a href="#mobile-menu" class="mobile-menu-toggle"><?php echo apply_filters('wpex_mobile_menu_open_button_text', '<span class="fa fa-navicon"></span>'); echo wpex_get_mod('mobile_menu_toggle_text', _x('Menu', 'Mobile Menu Toggle Button Text', 'wpex')); ?> </a>
<?php /** * Header Logo * * @package Total WordPress Theme * @subpackage Partials * @version 3.0.0 */ // Exit if accessed directly if (!defined('ABSPATH')) { exit; } // Define variables $logo_url = wpex_header_logo_url(); $logo_img = wpex_global_obj('header_logo'); $overlay_logo = wpex_header_overlay_logo(); $logo_icon = wpex_header_logo_icon(); $logo_title = wpex_header_logo_title(); ?> <div id="site-logo" class="<?php echo wpex_header_logo_classes(); ?> "> <div id="site-logo-inner" class="clr"> <?php if ($logo_img || $overlay_logo) { ?>
/** * Load VC CSS * * @since 2.0.0 */ public static function vc_css_ids($css) { $ids = wpex_global_obj('vc_css_ids'); if (!$ids) { return $css; } foreach ($ids as $id) { if ($id != wpex_global_obj('post_id') && ($vc_css = get_post_meta($id, '_wpb_shortcodes_custom_css', true))) { $css .= '/*VC META CSS*/' . $vc_css; } } return $css; }
/** * Adds js for the retina logo * * @since 1.1.0 */ function wpex_retina_logo() { // Get theme options $logo_url = wpex_get_mod('retina_logo'); $logo_height = wpex_get_mod('retina_logo_height'); // Translate theme mods $logo_url = wpex_translate_theme_mod('retina_logo', $logo_url); $logo_height = wpex_translate_theme_mod('retina_logo_height', $logo_height); // Header overlay Retina logo if (wpex_header_overlay_logo() && wpex_global_obj('has_overlay_header')) { $post_id = wpex_global_obj('post_id'); $overlay_retina_logo = get_post_meta($post_id, 'wpex_overlay_header_logo_retina', true); $overlay_retina_logo_height = get_post_meta($post_id, 'wpex_overlay_header_logo_retina_height', true); if ($overlay_retina_logo && $overlay_retina_logo_height) { if (is_numeric($overlay_retina_logo)) { $overlay_retina_logo = wp_get_attachment_image_src($overlay_retina_logo, 'full'); $overlay_retina_logo = $overlay_retina_logo[0]; } else { $overlay_retina_logo = esc_url($overlay_retina_logo); } if ($overlay_retina_logo) { $logo_url = $overlay_retina_logo; $logo_height = $overlay_retina_logo_height; } } } // Apply filters $logo_url = apply_filters('wpex_retina_logo_url', $logo_url); $logo_height = apply_filters('wpex_retina_logo_height', $logo_height); // Output JS for retina logo if ($logo_url && $logo_height) { $output = '<!-- Retina Logo --> <script type="text/javascript"> var $wpexRetinaLogo = "' . $logo_url . '", $wpexRetinaLogoHeight = "' . intval($logo_height) . '"; jQuery(function($){ if ( window.devicePixelRatio >= 2 ) { $("#site-logo img").attr("src", "' . $logo_url . '"); $("#site-logo img").css("max-height", "' . intval($logo_height) . 'px"); } }); </script>'; echo $output; } }
/** * Returns the correct title to display for any post/page/archive * * @package Total WordPress Theme * @subpackage Framework * @version 3.3.0 */ function wpex_title() { // Default title is null $title = NULL; // Get post ID from global object $post_id = wpex_global_obj('post_id'); // Homepage - display blog description if not a static page if (is_front_page() && !is_singular('page')) { if (get_bloginfo('description')) { $title = get_bloginfo('description'); } else { return esc_html__('Recent Posts', 'total'); } // Homepage posts page } elseif (is_home() && !is_singular('page')) { $title = get_the_title(get_option('page_for_posts', true)); } elseif (is_search()) { global $wp_query; $title = '<span id="search-results-count">' . $wp_query->found_posts . '</span> ' . esc_html__('Search Results Found', 'total'); } elseif (is_archive()) { // Author if (is_author()) { /*$title = sprintf( esc_html__( 'All posts by%s', 'total' ),': <span class="vcard">' . get_the_author() . '</span>' );*/ $title = get_the_archive_title(); } elseif (is_post_type_archive()) { $title = post_type_archive_title('', false); } elseif (is_day()) { $title = sprintf(esc_html__('Daily Archives: %s', 'total'), get_the_date()); } elseif (is_month()) { $title = sprintf(esc_html__('Monthly Archives: %s', 'total'), get_the_date(esc_html_x('F Y', 'Page title monthly archives date format', 'total'))); } elseif (is_year()) { $title = sprintf(esc_html__('Yearly Archives: %s', 'total'), get_the_date(esc_html_x('Y', 'Page title yearly archives date format', 'total'))); } else { // Get term title $title = single_term_title('', false); // Fix for bbPress and other plugins that are archives but use pages if (!$title) { global $post; $title = get_the_title($post_id); } } } elseif (is_404()) { $title = wpex_get_translated_theme_mod('error_page_title'); $title = $title ? $title : esc_html__('404: Page Not Found', 'total'); } elseif ($post_id) { // Single Pages if (is_singular('page') || is_singular('attachment')) { $title = get_the_title($post_id); } elseif (is_singular('post')) { $display = wpex_get_mod('blog_single_header'); $display = $display ? $display : 'custom_text'; if ('custom_text' == $display) { $title = wpex_get_mod('blog_single_header_custom_text'); $title = $title ? $title : esc_html__('Blog', 'total'); } elseif ('first_category' == $display) { $title = wpex_get_first_term_name(); } else { $title = get_the_title($post_id); } } else { $obj = get_post_type_object(get_post_type()); if (is_object($obj)) { $title = $obj->labels->name; } } } // Last check if title is empty $title = $title ? $title : get_the_title(); // Apply filters and return title return apply_filters('wpex_title', $title); }
// Return if $social_options array is empty if (empty($social_options)) { return; } // Add classes based on topbar style $classes = ''; $topbar_style = wpex_get_mod('top_bar_style', 'one'); if ('one' == $topbar_style) { $classes = 'top-bar-right'; } elseif ('two' == $topbar_style) { $classes = 'top-bar-left'; } elseif ('three' == $topbar_style) { $classes = 'top-bar-centered'; } // Display Social alternative if ($social_alt = wpex_global_obj('top_bar_social_alt')) { ?> <div id="top-bar-social-alt" class="clr <?php echo $classes; ?> "> <?php echo do_shortcode($social_alt); ?> </div><!-- #top-bar-social-alt --> <?php return; } ?>
/** * Outputs Custom CSS for the page title * * @since 1.5.3 */ function wpex_page_header_css($output) { // Get global object $obj = wpex_global_obj(); // Return output if page header is disabled if (!isset($obj->has_page_header) || !$obj->has_page_header) { return $output; } // Return if there isn't a page header style defined if (!$obj->page_header_style) { return $output; } // Define var $css = ''; // Check if a header style is defined and make header style dependent tweaks if ($obj->page_header_style) { // Customize background color if ($obj->page_header_style == 'solid-color' || $obj->page_header_style == 'background-image') { $bg_color = get_post_meta($obj->post_id, 'wpex_post_title_background_color', true); if ($bg_color) { $css .= 'background-color: ' . $bg_color . ' !important;'; } } // Background image Style if ($obj->page_header_style == 'background-image') { // Add background image $bg_img = wpex_page_header_background_image($obj->post_id); if ($bg_img) { // Add css for background image $css .= 'background-image: url(' . $bg_img . ' ) !important; background-position: 50% 0; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover;'; // Custom height $title_height = get_post_meta($obj->post_id, 'wpex_post_title_height', true); $title_height = $title_height ? $title_height : '400'; $title_height = apply_filters('wpex_post_title_height', $title_height); if ($title_height) { $css .= 'height:' . wpex_sanitize_data($title_height, 'px') . ' !important;'; } } } } // Apply all css to the page-header class if (!empty($css)) { $css = '.page-header { ' . $css . ' }'; } // Overlay Color if (!empty($bg_img)) { $overlay_color = get_post_meta($obj->post_id, 'wpex_post_title_background_overlay', true); if ('bg_color' == $overlay_color && $obj->page_header_style == 'background-image' && isset($bg_color)) { $css .= '.background-image-page-header-overlay { background-color: ' . $bg_color . ' !important; }'; } } // If css var isn't empty add to custom css output if (!empty($css)) { $output .= $css; } // Return output return $output; }
/** * Topbar classes * * @since 2.0.0 */ function wpex_top_bar_classes() { // Define classes $classes = array('wpex-clr'); // Check for content if (wpex_global_obj('top_bar_content')) { $classes[] = 'has-content'; } // Get topbar style $style = wpex_top_bar_style(); // Add classes based on top bar style if ('one' == $style) { $classes[] = 'top-bar-left'; } elseif ('two' == $style) { $classes[] = 'top-bar-right'; } elseif ('three' == $style) { $classes[] = 'top-bar-centered'; } // Apply filters for child theming $classes = apply_filters('wpex_top_bar_classes', $classes); // Turn classes array into space seperated string $classes = implode(' ', $classes); // Return classes return esc_attr($classes); }
function wpex_get_page_subheading() { return wpex_global_obj('get_page_subheading'); }
/** * Post slider output * * @package Total WordPress theme * @subpackage Partials * @version 3.0.0 */ // Exit if accessed directly if (!defined('ABSPATH')) { exit; } // Get post id $post_id = wpex_global_obj('post_id'); // Get the Slider shortcode $slider = wpex_global_obj('post_slider_shortcode'); // Disable on Mobile? $disable_on_mobile = get_post_meta($post_id, 'wpex_disable_post_slider_mobile', true); // Get slider alternative $slider_alt = get_post_meta($post_id, 'wpex_post_slider_mobile_alt', true); // Check if alider alternative for mobile custom field has a value if ('on' == $disable_on_mobile && $slider_alt) { // Sanitize slider mobile alt if (is_numeric($slider_alt)) { $slider_alt = wp_get_attachment_image_src($slider_alt, 'full'); $slider_alt = $slider_alt[0]; } // Cleanup validation for old Redux system if (is_array($slider_alt) && !empty($slider_alt['url'])) { $slider_alt = $slider_alt['url']; }
/** * Adds classes to the body tag * * @package Total WordPress Theme * @subpackage Framework * @version 3.3.0 */ function wpex_body_classes($classes) { // Save some vars $main_layout = wpex_global_obj('main_layout'); $header_style = wpex_global_obj('header_style'); $post_layout = wpex_global_obj('post_layout'); $post_id = wpex_global_obj('post_id'); // RTL if (is_RTL()) { $classes[] = 'rtl'; } // Customizer if (is_customize_preview()) { $classes[] = 'is_customize_preview'; } // Main class $classes[] = 'wpex-theme'; // Responsive if (wpex_global_obj('responsive')) { $classes[] = 'wpex-responsive'; } // Layout Style $classes[] = $main_layout . '-main-layout'; // Add skin to body classes $classes[] = 'skin-' . wpex_global_obj('skin'); // Vertical header style if ('six' == $header_style) { $classes[] = 'wpex-has-vertical-header'; if ('fixed' == wpex_get_mod('vertical_header_style')) { $classes[] = 'wpex-fixed-vertical-header'; } } // Check if the Visual Composer is being used on this page if (wpex_global_obj('has_composer')) { $classes[] = 'has-composer'; } else { $classes[] = 'no-composer'; } // Live site class if (!wpex_global_obj('vc_is_inline')) { $classes[] = 'wpex-live-site'; } // Boxed Layout dropshadow if ('boxed' == $main_layout && wpex_get_mod('boxed_dropdshadow') && 'gaps' != wpex_global_obj('skin')) { $classes[] = 'wrap-boxshadow'; } // Sidebar enabled if ('left-sidebar' == $post_layout || 'right-sidebar' == $post_layout) { $classes[] = 'has-sidebar'; } // Content layout if ($post_layout) { $classes[] = 'content-' . $post_layout; } // 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 (wpex_global_obj('has_breadcrumbs')) { $classes[] = 'has-breadcrumbs'; $classes[] = 'breadcrumbs-position-' . wpex_get_mod('breadcrumbs_position', 'default'); } // Topbar if (wpex_global_obj('has_top_bar')) { $classes[] = 'has-topbar'; } // Widget Icons if (wpex_get_mod('has_widget_icons', true)) { $classes[] = 'sidebar-widget-icons'; } // Overlay header style if (wpex_global_obj('has_overlay_header')) { $classes[] = 'has-overlay-header'; } // Footer reveal if (wpex_global_obj('has_footer_reveal')) { $classes[] = 'footer-has-reveal'; } // Slider if (wpex_global_obj('has_post_slider')) { $classes[] = 'page-with-slider'; } // No header margin if ('on' == get_post_meta($post_id, 'wpex_disable_header_margin', true)) { $classes[] = 'no-header-margin'; } // Title with Background Image if ('background-image' == wpex_global_obj('page_header_style')) { $classes[] = 'page-with-background-title'; } // Disabled header if (!wpex_global_obj('has_page_header')) { $classes[] = 'page-header-disabled'; } // Disabled main header if (!wpex_global_obj('has_header')) { $classes[] = 'wpex-site-header-disabled'; } // Page slider if (wpex_global_obj('has_post_slider') && ($slider_position = wpex_global_obj('post_slider_position'))) { $classes[] = 'has-post-slider'; $slider_position = str_replace('_', '-', $slider_position); $classes[] = 'post-slider-' . $slider_position; } // Font smoothing if (wpex_get_mod('enable_font_smoothing')) { $classes[] = 'smooth-fonts'; } // Mobile menu toggle style $classes[] = 'wpex-mobile-toggle-menu-' . wpex_global_obj('mobile_menu_toggle_style'); // Mobile menu style if ('disabled' == wpex_global_obj('mobile_menu_style')) { $classes[] = 'mobile-menu-disabled'; } else { $classes[] = 'has-mobile-menu'; } // Fixed Footer - adds min-height to main wraper if (wpex_get_mod('fixed_footer', false)) { $classes[] = 'wpex-has-fixed-footer'; } // Navbar inner span bg if (wpex_get_mod('menu_link_span_background')) { $classes[] = 'navbar-has-inner-span-bg'; } // Check if avatars are enabled if (is_singular() && !get_option('show_avatars')) { $classes[] = 'comment-avatars-disabled'; } // Return classes return $classes; }
/** * Returns the correct title to display for any post/page/archive * * @package Total WordPress Theme * @subpackage Framework */ function wpex_title() { // Default title is null $title = NULL; // Get post ID from global object $post_id = wpex_global_obj('post_id'); // Homepage - display blog description if not a static page if (is_front_page() && !is_singular('page')) { if (get_bloginfo('description')) { $title = get_bloginfo('description'); } else { return __('Recent Posts', 'wpex'); } // Homepage posts page } elseif (is_home() && !is_singular('page')) { $title = get_the_title(get_option('page_for_posts', true)); } elseif (is_search()) { global $wp_query; $title = '<span id="search-results-count">' . $wp_query->found_posts . '</span> ' . __('Search Results Found', 'wpex'); } elseif (is_archive()) { // Author if (is_author()) { /*$title = sprintf( __( 'All posts by%s', 'wpex' ),': <span class="vcard">' . get_the_author() . '</span>' );*/ $title = get_the_archive_title(); } elseif (is_post_type_archive()) { $title = post_type_archive_title('', false); } elseif (is_day()) { $title = sprintf(__('Daily Archives: %s', 'wpex'), get_the_date()); } elseif (is_month()) { $title = sprintf(__('Monthly Archives: %s', 'wpex'), get_the_date(_x('F Y', 'monthly archives date format', 'wpex'))); } elseif (is_year()) { $title = sprintf(__('Yearly Archives: %s', 'wpex'), get_the_date(_x('Y', 'yearly archives date format', 'wpex'))); } else { // Get term title $title = single_term_title('', false); // Fix for bbPress and other plugins that are archives but use pages if (!$title) { global $post; $title = get_the_title($post_id); } } } elseif (is_404()) { $title = wpex_get_mod('error_page_title'); $title = $title ? $title : __('404: Page Not Found', 'wpex'); $title = wpex_translate_theme_mod('error_page_title', $title); } elseif ($post_id) { // Single posts custom text if (is_singular('post') && 'custom_text' == wpex_get_mod('blog_single_header', 'custom_text')) { $title = wpex_get_mod('blog_single_header_custom_text', __('Blog', 'wpex')); } else { $title = get_the_title($post_id); } } // Backup $title = $title ? $title : get_the_title(); // Apply filters $title = apply_filters('wpex_title', $title); // Return title return $title; }
/** * Gets the footer builder template part if the footer is enabled * * @since 2.0.0 */ public static function get_part() { if (wpex_global_obj('has_footer')) { get_template_part('partials/footer/footer-builder'); } }
/** * No initialization allowed * Constructor defines variables only * * @since 1.0.0 */ public function __construct() { $this->retina_enabled = apply_filters('wpex_image_resize_retina', wpex_global_obj('retina')); }
/** * Main constructor * * @since 3.0.9 */ public function __construct() { $this->post_id = wpex_global_obj('post_id'); $this->itemscope = 'itemscope="" itemtype="http://data-vocabulary.org/Breadcrumb"'; $this->generate_crumbs(); }
/** * Adds cart icon to menu * * @since 3.0.0 */ public static function menu_cart_icon($items, $args) { // Only used for the main menu if ('main_menu' != $args->theme_location) { return $items; } // Get style $style = wpex_global_obj('menu_cart_style'); // Return items if no style if (!$style) { return $items; } // Toggle class $toggle_class = 'toggle-cart-widget'; // Define classes to add to li element $classes = array('woo-menu-icon', 'wpex-menu-extra'); // Add style class $classes[] = 'wcmenucart-toggle-' . $style; // Prevent clicking on cart and checkout if ('custom-link' != $style && (is_cart() || is_checkout())) { $classes[] = 'nav-no-click'; } else { $classes[] = $toggle_class; } // Turn classes into string $classes = implode(' ', $classes); // Add cart link to menu items $items .= '<li class="' . $classes . '">' . wpex_wcmenucart_menu_item() . '</li>'; // Return menu items return $items; }
* @package Total WordPress Theme * @subpackage Partials * @version 3.0.0 */ // Exit if accessed directly if (!defined('ABSPATH')) { exit; } ?> <?php wpex_hook_footer_before(); ?> <?php if (wpex_global_obj('has_footer_widgets')) { ?> <footer id="footer" class="site-footer"<?php wpex_schema_markup('footer'); ?> > <?php wpex_hook_footer_top(); ?> <div id="footer-inner" class="container clr"> <?php wpex_hook_footer_inner();
* @package Total WordPress theme * @subpackage Partials * @version 3.3.0 */ // Exit if accessed directly if (!defined('ABSPATH')) { exit; } // Add label based on post ID $post_id = wpex_global_obj('post_id'); $rand = $post_id ? $post_id : rand(); $label = 'pwbox-' . $rand; // Main classes $classes = 'password-protection-box clr'; // Add container for full-screen layout to center it if ('full-screen' == wpex_global_obj('post_layout')) { $classes .= ' container'; } ?> <div class="<?php echo esc_attr($classes); ?> "> <form action="<?php echo esc_url(site_url('wp-login.php?action=postpass', 'login_post')); ?> " method="post"> <h2><?php esc_html_e('Password Protected', 'total'); ?>
/** * Outputs page/post slider based on the wpex_post_slider_shortcode custom field * * @since Total 1.0.0 */ function wpex_post_slider($post_id = '', $postion = '') { // Return if there isn't a slider defined if (!wpex_global_obj('has_post_slider')) { return; } // Get current filter $filter = current_filter(); // Define get variable $get = false; // Get slider position $position = wpex_global_obj('post_slider_position'); // Get current filter against slider position if ('above_topbar' == $position && 'wpex_hook_topbar_before' == $filter) { $get = true; } elseif ('above_header' == $position && 'wpex_hook_header_before' == $filter) { $get = true; } elseif ('above_menu' == $position && 'wpex_hook_header_bottom' == $filter) { $get = true; } elseif ('above_title' == $position && 'wpex_hook_page_header_before' == $filter) { $get = true; } elseif ('below_title' == $position && 'wpex_hook_main_top' == $filter) { $get = true; } // Return if $get is still false after checking filters if ($get) { get_template_part('partials/post-slider'); } }