Ejemplo n.º 1
0
 function wpex_page_backgrounds($title = '')
 {
     // Get current ID
     $post_id = wpex_get_the_id();
     // Return if there isn't an ID
     if (!$post_id) {
         return;
     }
     // CSS variable
     $css = '';
     // Background Color
     $bg_color = get_post_meta($post_id, 'wpex_page_background_color', true);
     if ($bg_color && '#' != $bg_color) {
         $css .= 'background-color:' . $bg_color . ' !important;';
     }
     // Background image
     $bg_img = get_post_meta($post_id, 'wpex_page_background_image_redux', true);
     if (is_array($bg_img)) {
         if (!empty($bg_img['url'])) {
             $bg_img = $bg_img['url'];
         } else {
             $bg_img = '';
         }
     }
     // Fallback for old meta
     if (!$bg_img) {
         $bg_img = get_post_meta($post_id, 'wpex_page_background_image', true);
         if ($bg_img && !is_array($bg_img)) {
             $bg_img = $bg_img;
         } else {
             $bg_img = '';
         }
     }
     // Return if no background image is defined
     if (!$bg_img && !$bg_color) {
         return;
     }
     // Background Image
     if ($bg_img) {
         // Get Background image style
         $bg_img_style = get_post_meta($post_id, 'wpex_page_background_image_style', true);
         $bg_img_style = $bg_img_style ? $bg_img_style : 'stretched';
         // Apply background image style
         if ('repeat' == $bg_img_style) {
             $css .= 'background-image: url(' . $bg_img . ') !important; background-repeat: repeat;';
         }
         if ('fixed' == $bg_img_style) {
             $css .= 'background-image: url(' . $bg_img . ') !important; background-position: center top; background-attachment fixed; background-repeat no-repeat;';
         }
         if ('stretched' == $bg_img_style || 'streched' == $bg_img_style) {
             $css .= 'background-image: url(' . $bg_img . ') !important; background-repeat: no-repeat; background-position: center center;  background-attachment: fixed; -webkit-background-size: cover !important; -moz-background-size: cover !important; -o-background-size: cover !important; background-size: cover !important;';
         }
     }
     // If CSS var isn't empty output CSS otherwise return nothing
     if ('' != $css) {
         $css = 'body {' . $css . '}';
         $css = '/*CUSTOM PAGE BACKGROUNDS CSS*/' . $css;
         return $css;
     }
 }
Ejemplo n.º 2
0
/**
 * Sets the correct layout for posts
 *
 * @since Total 1.0.0
 */
function wpex_post_layout($post_id = '')
{
    // Get ID if not defined
    $post_id = $post_id ? $post_id : wpex_get_the_id();
    // Define variables
    $class = 'right-sidebar';
    $meta = get_post_meta($post_id, 'wpex_post_layout', true);
    // Check meta first to override and return (prevents filters from overriding meta)
    if ($meta) {
        return $meta;
    }
    // Singular Page
    if (is_page()) {
        // Blog template
        if (is_page_template('templates/blog.php')) {
            $class = wpex_get_mod('blog_archives_layout', 'right-sidebar');
        }
        // Landing Page
        if (is_page_template('templates/landing-page.php')) {
            $class = 'full-width';
        } elseif (is_attachment()) {
            $class = 'full-width';
        } else {
            $class = wpex_get_mod('page_single_layout', 'right-sidebar');
        }
    } elseif (is_singular('post')) {
        $class = wpex_get_mod('blog_single_layout', 'right-sidebar');
    } elseif (is_singular('attachment')) {
        $class = 'full-width';
    } elseif (is_home()) {
        $class = wpex_get_mod('blog_archives_layout', 'right-sidebar');
    } elseif (is_search()) {
        $class = wpex_get_mod('search_layout', 'right-sidebar');
    } elseif (is_category()) {
        $class = wpex_get_mod('blog_archives_layout', 'right-sidebar');
        $term = get_query_var('cat');
        $term_data = get_option("category_{$term}");
        if ($term_data) {
            if (!empty($term_data['wpex_term_layout'])) {
                $class = $term_data['wpex_term_layout'];
            }
        }
    } elseif (wpex_is_blog_query()) {
        $class = wpex_get_mod('blog_archives_layout', 'right-sidebar');
    } elseif (is_404()) {
        $class = 'full-width';
    } else {
        $class = 'right-sidebar';
    }
    // Class should never be empty
    if (empty($class)) {
        $class = 'right-sidebar';
    }
    // Apply filters for child theme editing
    $class = apply_filters('wpex_post_layout_class', $class);
    // Return correct classname
    return $class;
}
Ejemplo n.º 3
0
 function wpex_custom_menu($menu = false)
 {
     if ($post_id = wpex_get_the_id()) {
         if (($meta = get_post_meta($post_id, 'wpex_custom_menu', true)) && 'default' != $meta) {
             $menu = $meta;
         }
     }
     return apply_filters('wpex_custom_menu', $menu);
 }
Ejemplo n.º 4
0
 function wpex_toggle_bar_active($return = true)
 {
     if (!get_theme_mod('toggle_bar')) {
         $return = false;
     } elseif (!get_theme_mod('toggle_bar_page')) {
         $return = false;
     } elseif (($post_id = wpex_get_the_id()) && 'on' == get_post_meta($post_id, 'wpex_disable_toggle_bar', true)) {
         $return = false;
     } else {
         $return = true;
     }
     $return = apply_filters('wpex_toggle_bar_active', $return);
     return $return;
 }
Ejemplo n.º 5
0
 function wpex_is_top_bar_enabled($return = true)
 {
     if (!get_theme_mod('top_bar', true)) {
         $return = false;
     } elseif (($post_id = wpex_get_the_id()) && 'on' == get_post_meta($post_id, 'wpex_disable_top_bar', true)) {
         $return = false;
     } elseif (wpex_is_overlay_header_enabled()) {
         $return = false;
     } else {
         $return = true;
     }
     $return = apply_filters('wpex_is_top_bar_enabled', $return);
     return $return;
 }
Ejemplo n.º 6
0
 function wpex_header_classes($post_id = '')
 {
     // Post id
     $post_id = $post_id ? $post_id : wpex_get_the_id();
     // Get header style
     $header_style = wpex_get_header_style($post_id);
     // Check if is mobile
     $is_mobile = wp_is_mobile();
     // Fixed Header
     $fixed_header = get_theme_mod('fixed_header', true);
     // Setup classes array
     $classes = array();
     // Clearfix class
     $classes['clr'] = 'clr';
     // Main header style
     $classes['header_style'] = 'header-' . $header_style;
     // Sticky Header
     if (!$is_mobile && $fixed_header && 'one' == $header_style) {
         $classes['fixed_scroll'] = 'fixed-scroll';
     }
     // Header Overlay Style
     if ($post_id && wpex_is_overlay_header_enabled($post_id)) {
         // Remove fixed scroll class
         unset($classes['fixed_scroll']);
         // Add overlay header class
         $classes['overlay_header'] = 'overlay-header';
         // Add a fixed class for the overlay-header style only
         if (!$is_mobile && $fixed_header) {
             $classes['fix_on_scroll'] = 'fix-on-scroll';
         }
         // Add overlay header style class
         if ($meta = get_post_meta($post_id, 'wpex_overlay_header_style', true)) {
             $overlay_style = $meta;
         } else {
             $overlay_style = 'light';
         }
         $classes['overlay_header_style'] = $overlay_style . '-style';
     }
     // Apply filters
     $classes = apply_filters('wpex_header_classes', $classes);
     // Echo classes as space seperated classes
     echo implode(' ', $classes);
 }
Ejemplo n.º 7
0
 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;
 }
Ejemplo n.º 8
0
    function wpex_breadcrumbs($post_id = '')
    {
        // Globals
        global $wp_query, $wp_rewrite;
        // Get post id
        $post_id = $post_id ? $post_id : wpex_get_the_id();
        // Define main variables
        $breadcrumb = '';
        $trail = array();
        $path = '';
        $item_type_scope = 'itemscope="" itemtype="http://data-vocabulary.org/Breadcrumb"';
        // Default arguments
        $args = array('separator' => wpex_element('angle_right'), 'front_page' => false, 'echo' => false, 'show_posts_page' => true);
        // Extract args for easy variable naming.
        extract($args);
        /*-----------------------------------------------------------------------------------*/
        /*	- If not on the front page of the site, link to the home page
        		/*-----------------------------------------------------------------------------------*/
        if (!is_front_page()) {
            $home_title = get_theme_mod('breadcrumbs_home_title') ? get_theme_mod('breadcrumbs_home_title') : __('Home', 'wpex');
            $trail[] = '<span ' . $item_type_scope . '>
							<a href="' . home_url() . '" title="' . esc_attr(get_bloginfo('name')) . '" rel="home" class="trail-begin">
								<span itemprop="title">' . $home_title . '</span>
							</a>
						</span>';
        }
        /*-----------------------------------------------------------------------------------*/
        /*	- Front Page
        		/*-----------------------------------------------------------------------------------*/
        if (is_front_page()) {
            if (!$front_page) {
                $trail = false;
            } elseif ($show_home) {
                $trail['trail_end'] = "{$show_home}";
            }
        } elseif (is_home()) {
            $home_page = get_page($wp_query->get_queried_object_id());
            $trail = array_merge($trail, wpex_breadcrumbs_get_parents($home_page->post_parent, ''));
            $trail['trail_end'] = get_the_title($home_page->ID);
        } elseif (is_singular()) {
            // Get singular vars
            $post = $wp_query->get_queried_object();
            $post_id = absint($wp_query->get_queried_object_id());
            $post_type = $post->post_type;
            $parent = $post->post_parent;
            // If a custom post type, check if there are any pages in its hierarchy based on the slug.
            if (!in_array($post_type, array('page', 'post', 'product', 'portfolio', 'staff', 'testimonials'))) {
                $post_type_object = get_post_type_object($post_type);
                // Add $front to the path
                if ('post' == $post_type || 'attachment' == $post_type || $post_type_object->rewrite['with_front'] && $wp_rewrite->front) {
                    $path .= trailingslashit($wp_rewrite->front);
                }
                // Add slug to $path
                if (!empty($post_type_object->rewrite['slug'])) {
                    $path .= $post_type_object->rewrite['slug'];
                }
                // If $path exists check for parents
                if (!empty($path)) {
                    $trail = array_merge($trail, wpex_breadcrumbs_get_parents('', $path));
                }
                // If archive page exists add to trail
                if (!empty($post_type_object->has_archive) && function_exists('get_post_type_archive_link')) {
                    if (!is_singular('product')) {
                        $trail[] = '<span ' . $item_type_scope . ' class="trail-type-archive">
										<a href="' . get_post_type_archive_link($post_type) . '" title="' . esc_attr($post_type_object->labels->name) . '">
											<span itemprop="title">' . $post_type_object->labels->name . '</span>
										</a>
									</span>';
                    }
                }
            }
            // Add shop page to cart
            if (is_singular('page') && class_exists('Woocommerce')) {
                if (is_cart() || is_checkout()) {
                    // Get shop page
                    if (class_exists('Woocommerce') && function_exists('wc_get_page_id')) {
                        $shop_id = wc_get_page_id('shop');
                        $shop_page_url = get_permalink($shop_id);
                        $shop_title = get_the_title($shop_id);
                        if (function_exists('icl_object_id')) {
                            $shop_title = get_the_title(icl_object_id($shop_id, 'page'));
                        }
                        $shop_title = apply_filters('wpex_bcrums_shop_title', $shop_title);
                    }
                    // Shop page
                    if ($shop_id && $shop_title) {
                        $trail[] = '<span ' . $item_type_scope . ' class="trail-type-archive">
								<a href="' . get_permalink($shop_id) . '" title="' . esc_attr($shop_title) . '">
									<span itemprop="title">' . $shop_title . '</span>
								</a>
							</span>';
                    }
                }
            }
            // Standard Posts
            if ('post' == $post_type) {
                // Main Blog URL
                if ($blog_page = get_theme_mod('blog_page')) {
                    $blog_url = get_permalink($blog_page);
                    $blog_name = get_the_title($blog_page);
                    if (function_exists('icl_object_id')) {
                        $blog_name = get_the_title(icl_object_id($blog_page, 'page'));
                    }
                    $trail[] = '<span ' . $item_type_scope . ' class="trail-blog-url">
									<a href="' . $blog_url . '" title="' . $blog_name . '" itemprop="url">
										<span itemprop="title">' . $blog_name . '</span>
									</a>
								</span>';
                }
                // 1st Category
                if (get_theme_mod('breadcrumbs_blog_cat', '1')) {
                    $terms = get_the_terms($post_id, 'category');
                    if ($terms) {
                        $term = reset($terms);
                        $trail[] = '<span ' . $item_type_scope . ' class="trail-blog-cat">
										<a href="' . get_term_link($term) . '" itemprop="url" title="' . $term->name . '">
											<span itemprop="title">' . $term->name . '</span>
										</a>
									</span>';
                    }
                }
            }
            // Tribe Events
            if ('tribe_events' == $post_type && function_exists('tribe_get_events_link')) {
                $trail[] = '<span ' . $item_type_scope . ' class="trail-portfolio-url">
								<a href="' . tribe_get_events_link() . '" title="' . __('All Events', 'wpex') . '">
									<span itemprop="title">' . __('All Events', 'wpex') . '</span>
								</a>
							</span>';
            }
            //  Main Portfolio
            if ($post_type == 'portfolio') {
                if ($portfolio_page = get_theme_mod('portfolio_page')) {
                    $portfolio_url = get_permalink($portfolio_page);
                    $portfolio_name = get_the_title($portfolio_page);
                    if (function_exists('icl_object_id')) {
                        $portfolio_name = get_the_title(icl_object_id($portfolio_page, 'page'));
                    }
                    if ($portfolio_url) {
                        $trail[] = '<span ' . $item_type_scope . ' class="trail-portfolio-url">
									<a href="' . $portfolio_url . '" title="' . $portfolio_name . '">
										<span itemprop="title">' . $portfolio_name . '</span>
									</a>
								</span>';
                    }
                }
                // Portfolio 1st Category
                if (get_theme_mod('breadcrumbs_portfolio_cat', '1') && taxonomy_exists('portfolio_category')) {
                    $terms = get_the_terms($post_id, 'portfolio_category');
                    if ($terms) {
                        $term = reset($terms);
                        $trail[] = '<span ' . $item_type_scope . ' class="trail-portfolio-cat">
										<a href="' . get_term_link($term) . '" itemprop="url" title="' . $term->name . '">
											<span itemprop="title">' . $term->name . '</span>
										</a>
									</span>';
                    }
                }
            }
            //  Main Staff
            if ($post_type == 'staff') {
                // Display staff page
                if ($staff_page = get_theme_mod('staff_page')) {
                    $staff_url = get_permalink($staff_page);
                    $staff_name = get_the_title($staff_page);
                    if (function_exists('icl_object_id')) {
                        $staff_name = get_the_title(icl_object_id($staff_page, 'page'));
                    }
                    if ($staff_url) {
                        $trail[] = '<span ' . $item_type_scope . ' class="trail-staff-url">
									<a href="' . $staff_url . '" title="' . $staff_name . '">
										<span itemprop="title">' . $staff_name . '</span>
									</a>
								</span>';
                    }
                }
                // Staff 1st Category
                if (get_theme_mod('breadcrumbs_staff_cat', '1') && taxonomy_exists('staff_category')) {
                    $terms = get_the_terms($post_id, 'staff_category');
                    if ($terms) {
                        $term = reset($terms);
                        $trail[] = '<span ' . $item_type_scope . '>
										<a href="' . get_term_link($term) . '" itemprop="url" title="' . $term->name . '">
											<span itemprop="title">' . $term->name . '</span>
										</a>
									</span>';
                    }
                }
            }
            //  Main Testimonials
            if ($post_type == 'testimonials') {
                // Display testimonials page
                if ($testimonials_page = get_theme_mod('testimonials_page')) {
                    $testimonials_url = get_permalink($testimonials_page);
                    $testimonials_name = get_the_title($testimonials_page);
                    if (function_exists('icl_object_id')) {
                        $testimonials_name = get_the_title(icl_object_id($testimonials_page, 'page'));
                    }
                    if ($testimonials_url) {
                        $trail[] = '<span ' . $item_type_scope . ' class="trail-testimonials-url">
									<a href="' . $testimonials_url . '" title="' . $testimonials_name . '">
										<span itemprop="title">' . $testimonials_name . '</span>
									</a>
								</span>';
                    }
                }
                // Testimonials 1st Category
                if (get_theme_mod('breadcrumbs_testimonials_cat', '1') && taxonomy_exists('testimonials_category')) {
                    $terms = get_the_terms($post_id, 'testimonials_category');
                    if ($terms) {
                        $term = reset($terms);
                        $trail[] = '<span ' . $item_type_scope . '>
										<a href="' . get_term_link($term) . '" itemprop="url" title="' . $term->name . '">
											<span itemprop="title">' . $term->name . '</span>
										</a>
									</span>';
                    }
                }
            }
            // Products
            if (is_singular('product') && class_exists('Woocommerce')) {
                // Globals
                global $woocommerce;
                // Get shop page
                if (class_exists('Woocommerce') && function_exists('wc_get_page_id')) {
                    $shop_id = wc_get_page_id('shop');
                    $shop_page_url = get_permalink($shop_id);
                    $shop_title = get_the_title($shop_id);
                    if (function_exists('icl_object_id')) {
                        $shop_title = get_the_title(icl_object_id($shop_id, 'page'));
                    }
                    $shop_title = apply_filters('wpex_bcrums_shop_title', $shop_title);
                }
                // Shop page
                if ($shop_id && $shop_title) {
                    $trail[] = '<span ' . $item_type_scope . ' class="trail-type-archive">
							<a href="' . get_permalink($shop_id) . '" title="' . esc_attr($shop_title) . '">
								<span itemprop="title">' . $shop_title . '</span>
							</a>
						</span>';
                }
                // Cart page
                if (sizeof($woocommerce->cart->cart_contents) > 0) {
                    $cart_id = wc_get_page_id('cart');
                    $cart_title = get_the_title($cart_id);
                    if ($cart_id) {
                        $trail[] = '<span ' . $item_type_scope . ' class="trail-type-archive">
								<a href="' . get_permalink($cart_id) . '" title="' . esc_attr($cart_title) . '">
									<span itemprop="title">' . $cart_title . '</span>
								</a>
							</span>';
                    }
                }
            }
            // If the post type path returns nothing and there is a parent, get its parents.
            if (empty($path) && 0 !== $parent || 'attachment' == $post_type) {
                $trail = array_merge($trail, wpex_breadcrumbs_get_parents($parent, ''));
            }
            // End trail with post title
            $post_title = get_the_title($post_id);
            if (!empty($post_title)) {
                if ($trim_title = get_theme_mod('breadcrumbs_title_trim', '4')) {
                    $post_title = wp_trim_words($post_title, $trim_title);
                    $trail['trail_end'] = $post_title;
                } else {
                    $trail['trail_end'] = $post_title;
                }
            }
        } elseif (is_archive()) {
            // Add cart to shop
            if (function_exists('is_shop') && is_shop()) {
                global $woocommerce;
                if (sizeof($woocommerce->cart->cart_contents) > 0) {
                    $cart_id = wc_get_page_id('cart');
                    $cart_title = get_the_title($cart_id);
                    if ($cart_id) {
                        $trail[] = '<span ' . $item_type_scope . ' class="trail-type-archive">
								<a href="' . get_permalink($cart_id) . '" title="' . esc_attr($cart_title) . '">
									<span itemprop="title">' . $cart_title . '</span>
								</a>
							</span>';
                    }
                }
            }
            // Topics
            if (is_post_type_archive('topic')) {
                $forums_link = get_post_type_archive_link('forum');
                $forum_obj = get_post_type_object('forum');
                $forum_name = $forum_obj->labels->name;
                if ($forums_link) {
                    $trail[] = '<span ' . $item_type_scope . '><a href="' . $forums_link . '" title="' . $forum_name . '">' . $forum_name . '</a></span>';
                }
            }
            /*-----------------------------------------------------------------------------------*/
            /*	- Taxonomies
            			/*-----------------------------------------------------------------------------------*/
            if (is_tax() || is_category() || is_tag()) {
                // Get some taxonomy variables
                $term = $wp_query->get_queried_object();
                $taxonomy = get_taxonomy($term->taxonomy);
                // Link to main portfolio page
                if (function_exists('wpex_is_portfolio_tax') && wpex_is_portfolio_tax() && ($portfolio_page = get_theme_mod('portfolio_page'))) {
                    $portfolio_url = get_permalink($portfolio_page);
                    $portfolio_name = get_the_title($portfolio_page);
                    if (function_exists('icl_object_id')) {
                        $portfolio_name = get_the_title(icl_object_id($portfolio_page, 'page'));
                    }
                    if ($portfolio_url) {
                        $trail[] = '<span ' . $item_type_scope . ' class="trail-portfolio-url">
									<a href="' . $portfolio_url . '" title="' . $portfolio_name . '">
										<span itemprop="title">' . $portfolio_name . '</span>
									</a>
								</span>';
                    }
                }
                // Link to main staff page
                if (function_exists('wpex_is_staff_tax') && wpex_is_staff_tax() && ($staff_page = get_theme_mod('staff_page'))) {
                    $staff_url = get_permalink($staff_page);
                    $staff_name = get_the_title($staff_page);
                    if (function_exists('icl_object_id')) {
                        $staff_name = get_the_title(icl_object_id($staff_page, 'page'));
                    }
                    if ($staff_url) {
                        $trail[] = '<span ' . $item_type_scope . ' class="trail-staff-url">
									<a href="' . $staff_url . '" title="' . $staff_name . '">
										<span itemprop="title">' . $staff_name . '</span>
									</a>
								</span>';
                    }
                }
                // Testimonials Tax
                if (function_exists('wpex_is_testimonials_tax') && wpex_is_testimonials_tax() && ($testimonials_page = get_theme_mod('testimonials_page'))) {
                    $testimonials_url = get_permalink($testimonials_page);
                    $testimonials_name = get_the_title($testimonials_page);
                    if (function_exists('icl_object_id')) {
                        $testimonials_name = get_the_title(icl_object_id($testimonials_page, 'page'));
                    }
                    if ($testimonials_url) {
                        $trail[] = '<span ' . $item_type_scope . ' class="trail-testimonials-url">
									<a href="' . $testimonials_url . '" title="' . $testimonials_name . '">
										<span itemprop="title">' . $testimonials_name . '</span>
									</a>
								</span>';
                    }
                }
                // Woo Product Tax
                if (function_exists('wpex_is_woo_tax') && wpex_is_woo_tax()) {
                    // Get shop page
                    if (class_exists('Woocommerce') && function_exists('wc_get_page_id')) {
                        $shop_id = wc_get_page_id('shop');
                        $shop_page_url = get_permalink($shop_id);
                        $shop_title = get_the_title($shop_id);
                        if (function_exists('icl_object_id')) {
                            $shop_title = get_the_title(icl_object_id($shop_id, 'page'));
                        }
                        $shop_title = apply_filters('wpex_bcrums_shop_title', $shop_title);
                    }
                    if ($shop_page_url && $shop_title) {
                        $trail[] = '<span ' . $item_type_scope . ' class="trail-shop">
										<a href="' . $shop_page_url . '" title="' . $shop_title . '" itemprop="url">
											<span itemprop="title">' . $shop_title . '</span>
										</a>
									</span>';
                    }
                }
                // Display main blog page on Categories & archives
                if (is_category() || is_tag()) {
                    if ($blog_page = get_theme_mod('blog_page')) {
                        $blog_url = get_permalink($blog_page);
                        $blog_name = get_the_title($blog_page);
                        if (function_exists('icl_object_id')) {
                            $blog_name = get_the_title(icl_object_id($blog_page, 'page'));
                        }
                        $trail[] = '<span ' . $item_type_scope . ' class="trail-blog-url">
										<a href="' . $blog_url . '" title="' . $blog_name . '" itemprop="url">
											<span itemprop="title">' . $blog_name . '</span>
										</a>
									</span>';
                    }
                }
                // Get the path to the term archive. Use this to determine if a page is present with it.
                if (is_category()) {
                    $path = get_option('category_base');
                } elseif (is_tag()) {
                    $path = get_option('tag_base');
                } else {
                    if ($taxonomy->rewrite['with_front'] && $wp_rewrite->front) {
                        $path = trailingslashit($wp_rewrite->front);
                    }
                    $path .= $taxonomy->rewrite['slug'];
                }
                // Get parent pages if they exist
                if ($path) {
                    $trail = array_merge($trail, wpex_breadcrumbs_get_parents('', $path));
                }
                // Add term parents
                if (is_taxonomy_hierarchical($term->taxonomy) && $term->parent) {
                    $trail = array_merge($trail, wpex_breadcrumbs_get_term_parents($term->parent, $term->taxonomy));
                }
                // Add term name to trail end
                $trail['trail_end'] = $term->name;
            } elseif (is_post_type_archive()) {
                // Get post type object
                $post_type_object = get_post_type_object(get_query_var('post_type'));
                // Add $front to $path
                if ($post_type_object->rewrite['with_front'] && $wp_rewrite->front) {
                    $path .= trailingslashit($wp_rewrite->front);
                }
                // Add slug to 4path
                if (!empty($post_type_object->rewrite['archive'])) {
                    $path .= $post_type_object->rewrite['archive'];
                }
                // If patch exists check for parents
                if (!empty($path)) {
                    $trail = array_merge($trail, wpex_breadcrumbs_get_parents('', $path));
                }
                // Add post type name to trail end
                $trail['trail_end'] = $post_type_object->labels->name;
            } elseif (is_author()) {
                /* If $front has been set, add it to $path. */
                if (!empty($wp_rewrite->front)) {
                    $path .= trailingslashit($wp_rewrite->front);
                }
                /* If an $author_base exists, add it to $path. */
                if (!empty($wp_rewrite->author_base)) {
                    $path .= $wp_rewrite->author_base;
                }
                /* If $path exists, check for parent pages. */
                if (!empty($path)) {
                    $trail = array_merge($trail, wpex_breadcrumbs_get_parents('', $path));
                }
                /* Add the author's display name to the trail end. */
                $trail['trail_end'] = get_the_author_meta('display_name', get_query_var('author'));
            } elseif (is_time()) {
                if (get_query_var('minute') && get_query_var('hour')) {
                    $trail['trail_end'] = get_the_time(__('g:i a', 'wpex'));
                } elseif (get_query_var('minute')) {
                    $trail['trail_end'] = sprintf(__('Minute %1$s', 'wpex'), get_the_time(__('i', 'wpex')));
                } elseif (get_query_var('hour')) {
                    $trail['trail_end'] = get_the_time(__('g a', 'wpex'));
                }
            } elseif (is_date()) {
                // If $front is set check for parents
                if ($wp_rewrite->front) {
                    $trail = array_merge($trail, wpex_breadcrumbs_get_parents('', $wp_rewrite->front));
                }
                if (is_day()) {
                    $trail[] = '<a href="' . get_year_link(get_the_time('Y')) . '" title="' . get_the_time(esc_attr__('Y', 'wpex')) . '">' . get_the_time(__('Y', 'wpex')) . '</a>';
                    $trail[] = '<a href="' . get_month_link(get_the_time('Y'), get_the_time('m')) . '" title="' . get_the_time(esc_attr__('F', 'wpex')) . '">' . get_the_time(__('F', 'wpex')) . '</a>';
                    $trail['trail_end'] = get_the_time(__('j', 'wpex'));
                } elseif (get_query_var('w')) {
                    $trail[] = '<a href="' . get_year_link(get_the_time('Y')) . '" title="' . get_the_time(esc_attr__('Y', 'wpex')) . '">' . get_the_time(__('Y', 'wpex')) . '</a>';
                    $trail['trail_end'] = sprintf(__('Week %1$s', 'wpex'), get_the_time(esc_attr__('W', 'wpex')));
                } elseif (is_month()) {
                    $trail[] = '<a href="' . get_year_link(get_the_time('Y')) . '" title="' . get_the_time(esc_attr__('Y', 'wpex')) . '">' . get_the_time(__('Y', 'wpex')) . '</a>';
                    $trail['trail_end'] = get_the_time(__('F', 'wpex'));
                } elseif (is_year()) {
                    $trail['trail_end'] = get_the_time(__('Y', 'wpex'));
                }
            }
        } elseif (is_search()) {
            $trail['trail_end'] = sprintf(__('Search results for &quot;%1$s&quot;', 'wpex'), esc_attr(get_search_query()));
        } elseif (is_404()) {
            $trail['trail_end'] = get_theme_mod('error_page_title') ? get_theme_mod('error_page_title') : __('404 Not Found', 'wpex');
        } elseif (function_exists('tribe_is_month') && tribe_is_month()) {
            $trail['trail_end'] = __('Events Calendar', 'wpex');
        }
        /*-----------------------------------------------------------------------------------*/
        /*	- Create and return the breadcrumbs
        		/*-----------------------------------------------------------------------------------*/
        if ($trail && is_array($trail)) {
            $classes = 'site-breadcrumbs clr';
            if ($breadcrumbs_position = get_theme_mod('breadcrumbs_position')) {
                $classes .= ' position-' . $breadcrumbs_position;
            }
            // Open Breadcrumbs
            $breadcrumb = '<nav class="' . $classes . '"><div class="breadcrumb-trail">';
            // Seperator HTML
            $separator = '<span class="sep">' . $separator . '</span>';
            // Join all trail items into a string
            $breadcrumb .= implode($separator, $trail);
            // Close breadcrumbs
            $breadcrumb .= '</div></nav>';
        }
        // Return the breadcrumbs trail
        return $breadcrumb;
    }
Ejemplo n.º 9
0
    function wpex_post_slider($post_id = '', $postion = '')
    {
        // Get post ID
        $post_id = $post_id ? $post_id : wpex_get_the_id();
        // Return if no post ID
        if (!$post_id) {
            return;
        }
        // Get the Slider shortcode
        $slider = wpex_post_slider_shortcode($post_id);
        // Return if there isn't a slider defined
        if (!$slider) {
            return;
        }
        // Disable on mobile
        if ('on' == get_post_meta($post_id, 'wpex_disable_post_slider_mobile', true) && wp_is_mobile()) {
            return;
        }
        // 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 ($slider_alt) {
            // Cleanup validation for old Redux system
            if (is_array($slider_alt) && !empty($slider_alt['url'])) {
                $slider_alt = $slider_alt['url'];
            }
            // Mobile slider alternative link
            $slider_alt_url = get_post_meta($post_id, 'wpex_post_slider_mobile_alt_url', true);
            // Mobile slider alternative link target
            if ($slider_alt_target = get_post_meta($post_id, 'wpex_post_slider_mobile_alt_url_target', true)) {
                $slider_alt_target = 'target="_' . $slider_alt_target . '"';
            }
        } else {
            $slider_alt = $slider_alt_url = $slider_alt_target = NULL;
        }
        // Get post slider bottom margin
        $margin = get_post_meta($post_id, 'wpex_post_slider_bottom_margin', true);
        // Display Slider
        if ('' != $slider) {
            ?>
			<div class="page-slider clr">
				<?php 
            // Mobile slider
            if (wp_is_mobile() && $slider_alt) {
                if ($slider_alt_url) {
                    ?>
						<a href="<?php 
                    echo esc_url($slider_alt_url);
                    ?>
" title=""<?php 
                    echo $slider_alt_target;
                    ?>
>
							<img src="<?php 
                    echo $slider_alt;
                    ?>
" class="page-slider-mobile-alt" alt="<?php 
                    echo the_title();
                    ?>
" />
						</a>
					<?php 
                } else {
                    ?>
						<img src="<?php 
                    echo $slider_alt;
                    ?>
" class="page-slider-mobile-alt" alt="<?php 
                    echo the_title();
                    ?>
" />
					<?php 
                }
                ?>
				<?php 
            } else {
                echo do_shortcode($slider);
            }
            ?>
			</div><!-- .page-slider -->
			<?php 
            if ($margin) {
                ?>
				<div style="height:<?php 
                echo intval($margin);
                ?>
px;"></div>
			<?php 
            }
            ?>
		<?php 
        }
    }
Ejemplo n.º 10
0
 * Footer bottom content
 *
 * @package		Total
 * @subpackage	Partials/Footer
 * @author		Alexander Clarke
 * @copyright	Copyright (c) 2014, Symple Workz LLC
 * @link		http://www.wpexplorer.com
 * @since		Total 1.6.0
 * @version		1.0.0
 */
// Exit if accessed directly
if (!defined('ABSPATH')) {
    exit;
}
// Get post id
$post_id = wpex_get_the_id();
// Return if disabled
if (!wpex_display_callout($post_id)) {
    return;
}
// Get Content
if ($post_id && ($meta = get_post_meta($post_id, 'wpex_callout_text', true))) {
    $content = $meta;
} else {
    $content = get_theme_mod('callout_text', 'I am the footer call-to-action block, here you can add some relevant/important information about your company or product. I can be disabled in the theme options.');
}
// Bail if content is empty
if (!$content) {
    return;
}
// Get link
Ejemplo n.º 11
0
 function wpex_get_post_layout_class($post_id = '')
 {
     // Define variables
     $class = 'right-sidebar';
     $post_id = $post_id ? $post_id : wpex_get_the_id();
     // First check meta then run through all template parts
     if ($post_id && ($meta = get_post_meta($post_id, 'wpex_post_layout', true))) {
         $class = $meta;
     } elseif (is_singular('page')) {
         // Blog template
         if (is_page_template('templates/blog.php')) {
             $class = get_theme_mod('blog_archives_layout', 'right-sidebar');
         } else {
             $class = get_theme_mod('page_single_layout', 'right-sidebar');
         }
     } elseif (is_singular('post')) {
         $class = get_theme_mod('blog_single_layout', 'right-sidebar');
     } elseif (is_singular('portfolio')) {
         $class = get_theme_mod('portfolio_single_layout', 'right-sidebar');
     } elseif (is_singular('staff')) {
         $class = get_theme_mod('staff_single_layout', 'right-sidebar');
     } elseif (is_singular('testimonials')) {
         $class = get_theme_mod('testimonials_single_layout', 'right-sidebar');
     } elseif (wpex_is_woo_shop()) {
         $class = get_theme_mod('woo_shop_layout', 'full-width');
     } elseif (wpex_is_woo_tax()) {
         $class = get_theme_mod('woo_shop_layout', 'full-width');
     } elseif (wpex_is_woo_single()) {
         $class = get_theme_mod('woo_product_layout', 'full-width');
     } elseif (is_tax('portfolio_category') || is_tax('portfolio_tag')) {
         $class = get_theme_mod('portfolio_archive_layout', 'full-width');
     } elseif (is_tax('staff_category') || is_tax('staff_tag')) {
         $class = get_theme_mod('staff_archive_layout', 'full-width');
     } elseif (is_tax('testimonials_category') || is_tax('testimonials_tag')) {
         $class = get_theme_mod('testimonials_archive_layout', 'full-width');
     } elseif (is_home()) {
         $class = get_theme_mod('blog_archives_layout', 'right-sidebar');
     } elseif (is_category()) {
         $class = get_theme_mod('blog_archives_layout', 'right-sidebar');
         $term = get_query_var('cat');
         $term_data = get_option("category_{$term}");
         if ($term_data) {
             if (!empty($term_data['wpex_term_layout'])) {
                 $class = $term_data['wpex_term_layout'];
             }
         }
     } elseif (is_author()) {
         $class = get_theme_mod('blog_archives_layout', 'right-sidebar');
     } elseif (is_archive()) {
         $class = get_theme_mod('blog_archives_layout', 'right-sidebar');
     } elseif (function_exists('tribe_is_month')) {
         if (tribe_is_month()) {
             $class = 'full-width';
         } elseif (function_exists('tribe_is_event') && function_exists('tribe_is_day') && tribe_is_event() && !tribe_is_day() && !is_single()) {
             $class = 'full-width';
         } elseif (function_exists('tribe_is_day') && tribe_is_day()) {
             $class = 'full-width';
         }
         if (is_singular('tribe_events') && ($meta = get_post_meta($post_id, 'wpex_post_layout', true))) {
             $class = $meta;
         } else {
             $class = 'full-width';
         }
     }
     // Fallback so class is never empty
     if (empty($class)) {
         $class = 'right-sidebar';
     }
     // Apply filters for child theme editing
     $class = apply_filters('wpex_post_layout_class', $class);
     // Return correct classname
     return $class;
 }
Ejemplo n.º 12
0
    function wpex_social_share($post_id = NULL)
    {
        // Get sharing sites
        $defaults = array('twitter', 'facebook', 'google_plus', 'pinterest', 'linkedin');
        $sharing_sites = get_theme_mod('social_share_sites', $defaults);
        // Return nothing if there aren't any sites enabled
        if (empty($sharing_sites)) {
            return;
        }
        // Get post id
        $post_id = $post_id ? $post_id : wpex_get_the_id();
        // Don't show social sharing on password protected posts
        if (post_password_required($post_id)) {
            return;
        }
        // Check if disabled in page settings
        if ('on' == get_post_meta($post_id, 'wpex_disable_social', true)) {
            return;
        }
        // Get sharing options
        $position = get_theme_mod('social_share_position', 'horizontal');
        $style = get_theme_mod('social_share_style', 'minimal');
        // Output var
        $output = '';
        // Get and encode permalink
        $permalink = get_permalink($post_id);
        $url = urlencode($permalink);
        // Get and encode title
        $args = array('before' => false, 'after' => false, 'echo' => false, 'post' => $post_id);
        $title = urlencode(esc_attr(the_title_attribute($args)));
        // Get and encode summar
        $args = array('length' => '40', 'echo' => false);
        $summary = urlencode(wpex_excerpt($args));
        // Get image
        $img = wp_get_attachment_url(get_post_thumbnail_id($post_id));
        // Source URL
        $source = home_url();
        // Sharing block heading
        $heading = wpex_option('social_share_heading', __('Please Share This', 'wpex'));
        $heading = apply_filters('wpex_social_share_heading', $heading);
        // Get post layout
        $post_layout = wpex_get_post_layout_class($post_id);
        // Only display horizontal style menu for mobile devices
        if (wp_is_mobile()) {
            $position = 'horizontal';
        }
        // Tooltip Style
        if (is_rtl()) {
            $tooltip_class = 'tooltip-right';
        } elseif ($position == 'horizontal') {
            $tooltip_class = 'tooltip-up';
        } else {
            if ($post_layout == 'left-sidebar') {
                $tooltip_class = 'tooltip-left';
            } else {
                $tooltip_class = 'tooltip-right';
            }
        }
        // Display heading on Boxed layout
        if ($position == 'horizontal') {
            ?>
			<div class="social-share-title theme-heading"><span><?php 
            echo $heading;
            ?>
</span></div>
		<?php 
        }
        ?>

		<ul class="social-share-buttons position-<?php 
        echo $position;
        ?>
 style-<?php 
        echo $style;
        ?>
 clr">
			<?php 
        // Loop through each social sharing site that is enabled
        foreach ($sharing_sites as $site) {
            // Twitter
            if ('twitter' == $site) {
                ?>
					<li class="share-twitter">
						<a href="http://twitter.com/share?text=<?php 
                echo $title;
                ?>
&amp;url=<?php 
                echo $url;
                ?>
" target="_blank" title="<?php 
                _e('Share on Twitter', 'wpex');
                ?>
" rel="nofollow" class="<?php 
                echo $tooltip_class;
                ?>
" onclick="javascript:window.open(this.href, '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600');return false;">
							<span class="fa fa-twitter"></span>
							<?php 
                if ($position == 'horizontal') {
                    ?>
								<span class="social-share-button-text"><?php 
                    _e('Tweet', 'wpex');
                    ?>
</span>
							<?php 
                }
                ?>
						</a>
					</li>
				<?php 
            } elseif ('facebook' == $site) {
                ?>
					<li class="share-facebook">
						<a href="http://www.facebook.com/share.php?u=<?php 
                echo $url;
                ?>
" target="_blank" title="<?php 
                _e('Share on Facebook', 'wpex');
                ?>
" rel="nofollow" class="<?php 
                echo $tooltip_class;
                ?>
" onclick="javascript:window.open(this.href, '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600');return false;">
							<span class="fa fa-facebook"></span>
							<?php 
                if ($position == 'horizontal') {
                    ?>
								<span class="social-share-button-text"><?php 
                    _e('Like', 'wpex');
                    ?>
</span>
							<?php 
                }
                ?>
						</a>
					</li>
				<?php 
            } elseif ('google_plus' == $site) {
                ?>
					<li class="share-googleplus">
						<a title="<?php 
                _e('Share on Google+', 'wpex');
                ?>
" rel="external" href="https://plus.google.com/share?url=<?php 
                echo $url;
                ?>
" class="<?php 
                echo $tooltip_class;
                ?>
" onclick="javascript:window.open(this.href, '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600');return false;">
							<span class="fa fa-google-plus"></span>
							<?php 
                if ($position == 'horizontal') {
                    ?>
								<span class="social-share-button-text"><?php 
                    _e('Plus one', 'wpex');
                    ?>
</span>
							<?php 
                }
                ?>
						</a>
					</li>
				<?php 
            } elseif ('pinterest' == $site) {
                ?>
					<li class="share-pinterest">
						<a href="http://pinterest.com/pin/create/button/?url=<?php 
                echo $url;
                ?>
&amp;media=<?php 
                echo $img;
                ?>
&amp;description=<?php 
                echo $summary;
                ?>
" target="_blank" title="<?php 
                _e('Share on Pinterest', 'wpex');
                ?>
" rel="nofollow" class="<?php 
                echo $tooltip_class;
                ?>
" onclick="javascript:window.open(this.href, '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600');return false;">
							<span class="fa fa-pinterest"></span>
							<?php 
                if ($position == 'horizontal') {
                    ?>
								<span class="social-share-button-text"><?php 
                    _e('Pin It', 'wpex');
                    ?>
</span>
							<?php 
                }
                ?>
						</a>
					</li>
				<?php 
            } elseif ('linkedin' == $site) {
                ?>
					<li class="share-linkedin">
						<a title="<?php 
                _e('Share on LinkedIn', 'wpex');
                ?>
" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=<?php 
                echo $url;
                ?>
&amp;title=<?php 
                echo $title;
                ?>
&amp;summary=<?php 
                echo $summary;
                ?>
&amp;source=<?php 
                echo $source;
                ?>
" target="_blank" rel="nofollow" class="<?php 
                echo $tooltip_class;
                ?>
" onclick="javascript:window.open(this.href, '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600');return false;">
							<span class="fa fa-linkedin"></span>
							<?php 
                if ($position == 'horizontal') {
                    ?>
								<span class="social-share-button-text"><?php 
                    _e('Share', 'wpex');
                    ?>
</span>
							<?php 
                }
                ?>
						</a>
					</li>
				<?php 
            }
        }
        ?>
		</ul>
	<?php 
    }
Ejemplo n.º 13
0
 function wpex_page_header_css($output)
 {
     // Get post ID
     $post_id = wpex_get_the_id();
     // Return if ID not defined
     if (!$post_id) {
         return $output;
     }
     // Define var
     $css = $bg_img = '';
     $title_style = wpex_page_header_style($post_id);
     // Background Color
     if ($title_style == 'solid-color' || $title_style == 'background-image') {
         $bg_color = get_post_meta($post_id, 'wpex_post_title_background_color', true);
         if ($bg_color) {
             $css .= 'background-color: ' . $bg_color . ';';
         }
     }
     // Background image
     if ($title_style == 'background-image') {
         $bg_img = wpex_page_header_background_image($post_id);
         if ($bg_img) {
             $css .= 'background-image: url(' . $bg_img . ');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($post_id, 'wpex_post_title_height', true);
     if ($title_height) {
         $title_height = $title_height;
     } else {
         $title_height = '400';
     }
     if ($title_height && $bg_img) {
         $css .= 'height:' . intval($title_height) . 'px;';
     }
     // Apply all css to the page-header class
     if ('' != $css) {
         $output .= '.page-header { ' . $css . ' }';
     }
     // Overlay Color
     $overlay_color = get_post_meta($post_id, 'wpex_post_title_background_overlay', true);
     if ('bg_color' == $overlay_color && $title_style == 'background-image' && isset($bg_color)) {
         $output .= '.background-image-page-header-overlay { background-color: ' . $bg_color . '; }';
     }
     // Return css
     return $output;
 }
Ejemplo n.º 14
0
/**
 * Returns the correct sidebar ID
 *
 * @since 1.0.0
 */
function wpex_get_sidebar($sidebar = 'sidebar')
{
    // Pages
    if (is_page() && get_theme_mod('pages_custom_sidebar', '1')) {
        if (!is_page_template('templates/blog.php')) {
            $sidebar = 'pages_sidebar';
        }
    } elseif (is_singular('portfolio') || wpex_is_portfolio_tax()) {
        if (get_theme_mod('portfolio_custom_sidebar', '1')) {
            $sidebar = 'portfolio_sidebar';
        }
    } elseif (is_singular('staff') || wpex_is_staff_tax()) {
        if (get_theme_mod('staff_custom_sidebar', '1')) {
            $sidebar = 'staff_sidebar';
        }
    } elseif (is_singular('testimonials') || wpex_is_testimonials_tax()) {
        if (get_theme_mod('testimonials_custom_sidebar', '1')) {
            $sidebar = 'testimonials_sidebar';
        }
    } elseif (is_search() && get_theme_mod('search_custom_sidebar', '1')) {
        $sidebar = 'search_sidebar';
    } elseif (class_exists('Woocommerce') && get_theme_mod('woo_custom_sidebar', '1') && is_woocommerce()) {
        $sidebar = 'woo_sidebar';
    } elseif (function_exists('is_bbpress') && is_bbpress() && get_theme_mod('bbpress_custom_sidebar', '1')) {
        $sidebar = 'bbpress_sidebar';
    }
    // Check meta option as fallback
    if ($post_id = wpex_get_the_id()) {
        if ($meta = get_post_meta($post_id, 'sidebar', true)) {
            $sidebar = $meta;
        }
    }
    // Add filter for tweaking the sidebar display via child theme's
    $sidebar = apply_filters('wpex_get_sidebar', $sidebar);
    // Return the correct sidebar
    return $sidebar;
}
Ejemplo n.º 15
0
 function wpex_display_callout($post_id = '')
 {
     $post_id = $post_id ? $post_id : wpex_get_the_id();
     if ($post_id && 'on' == get_post_meta($post_id, 'wpex_disable_footer_callout', true)) {
         $return = false;
     } elseif ($post_id && get_post_meta($post_id, 'wpex_callout_text', true)) {
         $return = true;
     } elseif (!get_theme_mod('callout', '1')) {
         $return = false;
     } else {
         $return = true;
     }
     return apply_filters('wpex_disable_footer_callout', $return);
 }
Ejemplo n.º 16
0
    function wpex_advanced_styling()
    {
        // Get post id
        $post_id = wpex_get_the_id();
        // Define main vars
        $css = '';
        $add_css = '';
        //$main_layout	= wpex_main_layout( $post_id );
        /*-----------------------------------------------------------------------------------*/
        /*	- Fixed Header Height
        		/*-----------------------------------------------------------------------------------*/
        $header_height = '';
        if ('one' == get_theme_mod('header_style', 'one') && !wpex_is_overlay_header_enabled($post_id)) {
            $header_top_padding = intval(get_theme_mod('header_top_padding'));
            $header_bottom_padding = intval(get_theme_mod('header_bottom_padding'));
            $header_height = intval(get_theme_mod('header_height'));
            if ($header_height && '0' != $header_height && 'auto' != $header_height) {
                if ($header_top_padding || $header_bottom_padding) {
                    $header_height_plus_padding = $header_height + $header_top_padding + $header_bottom_padding;
                } else {
                    $header_height_plus_padding = $header_height + '60';
                }
                $css .= '.header-one #site-header { height: ' . $header_height . 'px; }
						 .header-one #site-navigation-wrap,
						 .navbar-style-one .dropdown-menu > li > a{height:' . $header_height_plus_padding . 'px}
						 .navbar-style-one .dropdown-menu > li > a{line-height:' . $header_height_plus_padding . 'px}
						 .header-one #site-logo,
						 .header-one #site-logo a{height:' . $header_height . 'px;line-height:' . $header_height . 'px}';
            }
        }
        /*-----------------------------------------------------------------------------------*/
        /*	- Logo
        		/*-----------------------------------------------------------------------------------*/
        // Reset $add_css var
        $add_css = '';
        // Logo top/bottom margins only if custom header height is empty
        if (!$header_height) {
            // Logo top margin
            $margin = intval(get_theme_mod('logo_top_margin'));
            if ('' != $margin && '0' != $margin) {
                if ($header_height && '0' != $header_height && 'auto' != $header_height && get_theme_mod('custom_logo', false, 'url')) {
                    $add_css .= 'padding-top: ' . $margin . 'px;';
                } else {
                    $add_css .= 'margin-top: ' . $margin . 'px;';
                }
            }
            // Logo bottom margin
            $margin = intval(get_theme_mod('logo_bottom_margin'));
            if ('' != $margin && '0' != $margin) {
                if ($header_height && '0' != $header_height && 'auto' != $header_height && get_theme_mod('custom_logo', false, 'url')) {
                    $add_css .= 'padding-bottom: ' . $margin . 'px;';
                } else {
                    $add_css .= 'margin-bottom: ' . $margin . 'px;';
                }
            }
        }
        // Logo max width
        $width = get_theme_mod('logo_max_width');
        if ('' != $width && '0' != $width) {
            $add_css .= 'max-width: ' . $width . ';';
        }
        // #site-logo css
        if ($add_css) {
            $css .= '#site-logo {' . $add_css . '}';
            $add_css = '';
        }
        /*-----------------------------------------------------------------------------------*/
        /*	- Other
        		/*-----------------------------------------------------------------------------------*/
        // Fix for Fonts In the Visual Composer
        $css .= '.wpb_row .fa:before {box-sizing:content-box!important;-moz-box-sizing:content-box!important;-webkit-box-sizing:content-box!important;}';
        /*-----------------------------------------------------------------------------------*/
        /*	- Output CSS
        		/*-----------------------------------------------------------------------------------*/
        if ('' != $css && !empty($css)) {
            $css = '/*ADVANCED STYLING START*/' . $css;
            return $css;
        }
    }