Example #1
0
function extra_layout_used()
{
    if (is_home() && et_extra_show_home_layout()) {
        return true;
    } else {
        if (is_category() || is_tag()) {
            if (extra_get_tax_layout_id()) {
                return true;
            }
        }
    }
    return false;
}
Example #2
0
function extra_sidebar()
{
    $is_woocommerce_sidebar = 'product' === get_query_var('post_type') || is_tax('product_cat') || is_tax('product_tag');
    if ($is_woocommerce_sidebar) {
        $post_id = empty($post_id) ? get_the_ID() : $post_id;
        $sidebar = get_post_meta($post_id, '_extra_sidebar', true);
        $sidebar_location = get_post_meta($post_id, '_extra_sidebar_location', true);
    } else {
        if (is_singular()) {
            $post_id = empty($post_id) ? get_the_ID() : $post_id;
            $sidebar = get_post_meta($post_id, '_extra_sidebar', true);
            $sidebar_location = get_post_meta($post_id, '_extra_sidebar_location', true);
        } else {
            if (is_archive()) {
                if ($layout_id = extra_get_tax_layout_id()) {
                    $sidebar = get_post_meta($layout_id, '_extra_sidebar', true);
                    $sidebar_location = get_post_meta($layout_id, '_extra_sidebar_location', true);
                }
            } else {
                if (is_home() && et_extra_show_home_layout()) {
                    if ($layout_id = extra_get_home_layout_id()) {
                        $sidebar = get_post_meta($layout_id, '_extra_sidebar', true);
                        $sidebar_location = get_post_meta($layout_id, '_extra_sidebar_location', true);
                    }
                }
            }
        }
    }
    if (empty($sidebar_location)) {
        if ($is_woocommerce_sidebar) {
            $sidebar_location = et_get_option('woocommerce_sidebar_location', extra_global_sidebar_location());
        } else {
            $sidebar_location = extra_global_sidebar_location();
        }
    }
    if ('none' === $sidebar_location) {
        return;
    }
    if (empty($sidebar)) {
        if ($is_woocommerce_sidebar) {
            $sidebar = et_get_option('woocommerce_sidebar', extra_global_sidebar());
        } else {
            $sidebar = extra_global_sidebar();
        }
    }
    return $sidebar;
}