Tagged: x
-
AuthorPosts
-
November 18, 2016 at 6:24 pm #1263084
janciParticipanthi, first of all thanks for the great theme!
I added the sidebar to the left side of the product page by using the php code I found in other threads. im attaching them bellow. However, the cart page sidebar got switched from left (which i want) to the right side.
Basicaly I am trying to keep it consistent across the whole page so the user has the sidebar always available and visible (kind of a dashboard)can you please advise how to achieve that?
thanks.// code to enable the layout of product page with sidebar function x_get_content_layout() { $stack = x_get_stack(); $content_layout = x_get_option( 'x_' . $stack . '_layout_content', 'content-sidebar' ); if ( $content_layout != 'full-width' ) { if ( is_home() ) { $opt = x_get_option( 'x_blog_layout', 'sidebar' ); $layout = ( $opt == 'sidebar' ) ? $content_layout : $opt; } elseif ( is_singular( 'post' ) ) { $meta = get_post_meta( get_the_ID(), '_x_post_layout', true ); $layout = ( $meta == 'on' ) ? 'full-width' : $content_layout; } elseif ( x_is_portfolio_item() ) { $layout = 'full-width'; } elseif ( x_is_portfolio() ) { $meta = get_post_meta( get_the_ID(), '_x_portfolio_layout', true ); $layout = ( $meta == 'sidebar' ) ? $content_layout : $meta; } elseif ( is_archive() ) { if ( x_is_shop() || x_is_product_category() || x_is_product_tag() || x_is_product() ) { $layout = 'sidebar-content'; } else { $opt = x_get_option( 'x_archive_layout', 'sidebar' ); $layout = ( $opt == 'sidebar' ) ? $content_layout : $opt; } } elseif ( x_is_product() ) { $layout = 'sidebar-content'; } elseif ( x_is_bbpress() ) { $opt = x_get_option( 'x_bbpress_layout_content', 'sidebar' ); $layout = ( $opt == 'sidebar' ) ? $content_layout : $opt; } elseif ( x_is_buddypress() ) { $opt = x_get_option( 'x_buddypress_layout_content', 'sidebar' ); $layout = ( $opt == 'sidebar' ) ? $content_layout : $opt; } elseif ( is_404() ) { $layout = 'full-width'; } else { $layout = $content_layout; } } else { $layout = $content_layout; } if ( is_page_template( 'template-layout-content-sidebar.php' ) ) { $layout = 'sidebar-content'; } elseif ( is_page_template( 'template-layout-sidebar-content.php' ) ) { $layout = 'sidebar-content'; } elseif ( is_page_template( 'template-layout-full-width.php' ) ) { $layout = 'full-width'; } return $layout; } add_filter( 'ups_sidebar', function ( $default_sidebar ) { $sidebars = get_option( 'ups_sidebars' ); foreach ( $sidebars as $id => $sidebar ) { if ( x_is_shop() || x_is_product_category() || x_is_product_tag() || x_is_product() ) { if ( array_key_exists( 'index-shop', $sidebar ) && $sidebar['index-shop'] == 'on' ) { return $id; } } } return $default_sidebar; }, 9999 );// code to display the sidebar on product page add_filter( 'ups_sidebar', 'woocommerce_sidebar', 9999 ); function woocommerce_sidebar ( $default_sidebar ) { $sidebars = get_option( 'ups_sidebars' ); foreach ( $sidebars as $id => $sidebar ) { if ( x_is_shop() || x_is_product_category() || x_is_product_tag() || x_is_product() ) { if ( array_key_exists( 'index-shop', $sidebar ) && $sidebar['index-shop'] == 'on' ) { return $id; } } } return $default_sidebar; }November 19, 2016 at 12:21 am #1263359
RadModeratorHi there,
Thanks for posting in.
You can hange all the instances of
'sidebar-content'to'content-sidebar'and it switch the position of sidebar and content.Cheers!
-
AuthorPosts
- <script> jQuery(function($){ $("#no-reply-1263084 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>
