Example #1
0
function venedor_banner($banner_class = '')
{
    $banner_type = venedor_meta_banner_type();
    $banner_width = venedor_meta_banner_width();
    $layer_slider = venedor_meta_layer_slider();
    $rev_slider = venedor_meta_rev_slider();
    $banner = venedor_meta_banner();
    $product_slider = venedor_meta_product_slider();
    if ($banner_type === 'layer_slider' && isset($layer_slider)) {
        ?>

        <?php 
        if ($banner_width != 'wide') {
            ?>
<div class="container"><?php 
        }
        ?>
            <div class="banner-container">
                <div id="banner-wrapper" class="<?php 
        echo $banner_class;
        ?>
">
                    <?php 
        echo do_shortcode('[layerslider id="' . $layer_slider . '"]');
        ?>
                </div>
        </div>
        <?php 
        if ($banner_width != 'wide') {
            ?>
</div><?php 
        }
        ?>

    <?php 
    } else {
        if ($banner_type === 'rev_slider' && isset($rev_slider)) {
            ?>

        <?php 
            if ($banner_width != 'wide') {
                ?>
<div class="container"><?php 
            }
            ?>
            <div class="banner-container">
                <div id="banner-wrapper" class="<?php 
            echo $banner_class;
            ?>
">
                    <?php 
            echo do_shortcode('[rev_slider ' . $rev_slider . ']');
            ?>
                </div>
            </div>
        <?php 
            if ($banner_width != 'wide') {
                ?>
</div><?php 
            }
            ?>

    <?php 
        } else {
            if ($banner_type === 'banner' && isset($banner)) {
                ?>

        <?php 
                if ($banner_width != 'wide') {
                    ?>
<div class="container"><?php 
                }
                ?>
            <div class="banner-container">
                <div id="banner-wrapper" class="<?php 
                echo $banner_class;
                ?>
">
                    <?php 
                echo do_shortcode($banner);
                ?>
                </div>
            </div>
        <?php 
                if ($banner_width != 'wide') {
                    ?>
</div><?php 
                }
                ?>

    <?php 
            } else {
                if (class_exists('WooCommerce') && $banner_type === 'product_slider' && isset($product_slider)) {
                    ?>

        <div class="banner-container">
            <div id="banner-wrapper" class="<?php 
                    echo $banner_class;
                    ?>
">
                <?php 
                    venedor_product_slider($product_slider);
                    ?>
            </div>
        </div>

    <?php 
                } else {
                    if (class_exists('WooCommerce')) {
                        if ($banner_type === 'featured_products') {
                            // use in woocommerce category page
                            ?>
            <?php 
                            if ($banner_width != 'wide') {
                                ?>
<div class="container"><?php 
                            }
                            ?>
                <div class="banner-container">
                    <div id="banner-wrapper" class="<?php 
                            echo $banner_class;
                            ?>
">
                        <?php 
                            venedor_featured_products_slider();
                            ?>
                    </div>
                </div>
            <?php 
                            if ($banner_width != 'wide') {
                                ?>
</div><?php 
                            }
                            ?>
         <?php 
                        } else {
                            // use in woocommerce category page
                            // verify that this is a product category page
                            if ($banner_type !== 'hide_banner' && is_product_category()) {
                                venedor_woocommerce_category_banner($banner_class);
                            }
                        }
                    }
                }
            }
        }
    }
}
Example #2
0
function venedor_meta_header_on_banner()
{
    global $wp_query, $venedor_settings;
    $header_on_banner = '';
    if (is_category()) {
        $cat = $wp_query->get_queried_object();
        $header_on_banner = get_metadata('category', $cat->term_id, 'header_on_banner', true);
    } else {
        if (is_archive()) {
            if (function_exists('is_shop') && is_shop()) {
                $header_on_banner = get_post_meta(wc_get_page_id('shop'), 'header_on_banner', true);
            } else {
                $term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy'));
                if ($term) {
                    $header_on_banner = get_metadata($term->taxonomy, $term->term_id, 'header_on_banner', true);
                }
            }
        } else {
            if (is_singular()) {
                $header_on_banner = get_post_meta(get_the_id(), 'header_on_banner', true);
            } else {
                if (!is_home() && is_front_page()) {
                    $header_on_banner = $venedor_settings['home-header-on-banner'];
                } else {
                    if (is_home() && !is_front_page()) {
                        $header_on_banner = $venedor_settings['blog-header-on-banner'];
                    } else {
                        if (is_home() || is_front_page()) {
                            $header_on_banner = $venedor_settings['home-header-on-banner'];
                        }
                    }
                }
            }
        }
    }
    $header_on_banner = $header_on_banner == 'header_on_banner' ? true : false;
    $banner_type = venedor_meta_banner_type();
    $rev_slider = venedor_meta_rev_slider();
    $layer_slider = venedor_meta_layer_slider();
    $banner = venedor_meta_banner();
    if ($header_on_banner && !($banner_type === 'layer_slider' && isset($layer_slider) || $banner_type === 'rev_slider' && isset($rev_slider) || $banner_type === 'banner' && isset($banner))) {
        $header_on_banner = false;
    }
    return $header_on_banner;
}