'sidebar-right' ) { $this->sidebar_class .= ' order-last'; } if( ! strstr( $this->sidebar_class, 'col-lg-0' ) ) { $this->sidebar_class .= ' ' . $layout; } if ( woodmart_woocommerce_installed() && is_product() ) { $this->sidebar_class .= ' single-product-sidebar'; } } /** * Set content column width * * @return integer */ public function get_sidebar_col_width() { return $this->sidebar_col_width; } /** * Set sidebar column width * */ private function _set_sidebar_col_width() { $size = 2; $specific = ''; // Set here page ID. Will be used to get custom value from metabox of specific PAGE | BLOG PAGE | SHOP PAGE. $page_id = $this->get_page_id(); $this->sidebar_col_width = woodmart_get_opt( 'sidebar_width' ); if( $page_id != 0 ) { $specific = get_post_meta( $page_id, '_woodmart_sidebar_width', true ); } // Get specific sidebar size for Shop Page if( woodmart_woocommerce_installed() && ( is_shop() || is_product_category() || is_product_tag() || woodmart_is_product_attribute_archive() || ( is_search() && isset( $_GET['post_type'] ) && 'product' === $_GET['post_type'] ) ) ) { $this->sidebar_col_width = woodmart_get_opt( 'shop_sidebar_width' ); } else if(is_singular( 'product' )) { // Get specific layout for SINGLE PRODUCT PAGE $this->sidebar_col_width = woodmart_get_opt( 'single_sidebar_width' ); } else if( is_home() || is_singular( 'post' ) || is_archive() ) { // Get specific sidebar size for Blog Page $this->sidebar_col_width = woodmart_get_opt( 'blog_sidebar_width' ); } elseif ( is_singular( 'woodmart_layout' ) ) { $this->sidebar_col_width = 0; } if( $specific != '' && $specific != 'default' ) { // Set specific sidebar size FOR THIS PAGE $this->sidebar_col_width = $specific; } // Remove theme sidebar for dokan store list page if( function_exists( 'dokan_is_store_page' ) && dokan_is_store_page() ) { $this->sidebar_col_width = 0; } $layout = $this->get_page_layout(); // Remove sidebar if it has no widgets $sidebar_name = $this->get_sidebar_name(); if ( ! is_active_sidebar( $sidebar_name ) && $sidebar_name != 'sidebar-product-single' ) { $this->sidebar_col_width = 0; } if( $layout == 'full-width' ) { $this->sidebar_col_width = 0; } if(empty($this->sidebar_col_width)) { $this->sidebar_col_width = 0; } } /** * Get page layout (sidebar position) * * @return string */ public function get_page_layout() { return apply_filters( 'woodmart_get_page_layout', $this->page_layout ); } /** * Set page layout (sidebar position) * */ private function _set_page_layout() { global $post, $WCMp; $specific = ''; // Set here page ID. Will be used to get custom value from metabox of specific PAGE | BLOG PAGE | SHOP PAGE. $page_id = $this->get_page_id(); $this->page_layout = 'sidebar-right'; $this->page_layout = woodmart_get_opt( 'main_layout' ); if ( ( is_singular( 'portfolio' ) || is_post_type_archive( 'portfolio' ) || is_tax( 'project-cat' ) ) && ! is_active_sidebar( 'portfolio-widgets-area' ) ) { $this->page_layout = 'full-width'; } if( $page_id != 0 ) { $specific = get_post_meta( $page_id, '_woodmart_main_layout', true ); } if ( woodmart_woocommerce_installed() && ( is_shop() || is_product_category() || is_product_tag() || woodmart_is_product_attribute_archive() || ( is_search() && isset( $_GET['post_type'] ) && 'product' === $_GET['post_type'] ) ) ) { // Get specific layout for Shop Page $this->page_layout = woodmart_get_opt( 'shop_layout' ); } else if( $this->is_account_pages() ) { $this->page_layout = 'full-width'; } else if( is_singular( 'product' ) ) { // Get specific layout for SINGLE PRODUCT PAGE $this->page_layout = woodmart_get_opt( 'single_product_layout' ); } else if( isset( $WCMp ) && is_tax( $WCMp->taxonomy->taxonomy_name ) ) { $this->page_layout = woodmart_get_opt( 'blog_layout' ); } else if( is_singular( 'post' ) || woodmart_is_blog_archive() ) { // Get specific layout for Blog Page $this->page_layout = woodmart_get_opt( 'blog_layout' ); // Disable sidebar if blog design is Masonry Grid if( woodmart_get_opt( 'blog_design' ) == 'masonry' && ! is_singular( 'post' ) ) { $this->page_layout = 'full-width'; } } if( $specific != '' && $specific != 'default' ) { // Set specific layout FOR THIS PAGE $this->page_layout = $specific; } } /** * Check if it is account page * * @return boolean */ public function is_account_page() { if( function_exists( 'is_account_page' ) ) { return is_account_page(); } else { return false; } } /** * Check if it is some account pages * * @return boolean */ public function is_account_pages() { $wishlist_page_id = woodmart_get_opt( 'wishlist_page' ); if( function_exists( 'is_account_page' ) ) { if( is_account_page() ) return true; } if( $this->get_page_id() == $wishlist_page_id ) { return true; } return false; } /** * Class for page content container * * @return mixed */ public function get_main_container_class() { $class = 'container'; $is_product_builder = Builder::get_instance()->has_custom_layout( 'single_product' ); // Different class for product page if( woodmart_woocommerce_installed() && is_singular( 'product' ) && !get_query_var( 'edit' ) && ( ( function_exists( 'woodmart_elementor_has_location' ) && ! woodmart_elementor_has_location( 'single' ) ) || ! function_exists( 'woodmart_elementor_has_location' ) ) ) { $class = 'container-fluid'; if ( $is_product_builder && 'enabled' === woodmart_get_opt( 'negative_gap' ) ) { $class = 'container'; } elseif ( $is_product_builder && 'disabled' === woodmart_get_opt( 'negative_gap' ) ) { $class = 'container-fluid'; } } if ( ( woodmart_get_portfolio_page_id() == woodmart_page_ID() ) && woodmart_get_opt( 'portfolio_full_width' ) ) { $class = 'container-fluid container-no-gutters'; } if ( woodmart_is_elementor_full_width() ) { $class = 'container-fluid container-no-gutters'; } return apply_filters( 'woodmart_main_content_classes', $class ); } /** * Gets the value of page_id. * * @return mixed */ public function get_page_id() { return $this->page_id; } /** * Gets the value of sidebar_name. * * @return mixed */ public function get_sidebar_name() { return apply_filters( 'woodmart_get_sidebar_name', $this->sidebar_name ); } } if( ! function_exists( 'woodmart_page_ID' ) ) { function woodmart_page_ID() { return WOODMART_Registry()->layout->get_page_id(); } } if( ! function_exists( 'woodmart_get_content_class' ) ) { function woodmart_get_content_class() { return WOODMART_Registry()->layout->get_content_class(); } } if( ! function_exists( 'woodmart_get_content_col_width' ) ) { function woodmart_get_content_col_width() { return WOODMART_Registry()->layout->get_content_col_width(); } } if( ! function_exists( 'woodmart_get_sidebar_class' ) ) { function woodmart_get_sidebar_class() { return WOODMART_Registry()->layout->get_sidebar_class(); } } if( ! function_exists( 'woodmart_get_page_layout' ) ) { function woodmart_get_page_layout() { return WOODMART_Registry()->layout->get_page_layout(); } } if( ! function_exists( 'woodmart_get_sidebar_col_width' ) ) { function woodmart_get_sidebar_col_width() { return WOODMART_Registry()->layout->get_sidebar_col_width(); } } if( ! function_exists( 'woodmart_get_sidebar_name' ) ) { function woodmart_get_sidebar_name() { return WOODMART_Registry()->layout->get_sidebar_name(); } } if( ! function_exists( 'woodmart_get_main_container_class' ) ) { function woodmart_get_main_container_class() { return WOODMART_Registry()->layout->get_main_container_class(); } }