Tagged: x
-
AuthorPosts
-
April 18, 2016 at 3:20 pm #888903
rkcreaghParticipantHi X team,
I’ve run into some trouble trying to get a sidebar to show up on product pages. I’ve searched here and the solutions provided haven’t worked for me.
I have one other issue that’s very similar but I’m not sure if you’ll support it. I’m using the Woocommerce Brands plugin from proword on codecanyon. When viewing a brand’s page that lists all the products under that brand I cannot get the sidebar to appear there either.
Other than that X has been great to work with, I’ll definitely be using it for more client projects.
Thanks for your help!
Ryan.
April 19, 2016 at 3:38 am #889546
LelyModeratorHello Ryan,
Because this requires a template change, I’d advise that you setup a child theme. This allows you to make code changes that won’t be overwritten when an X update is released. After your child theme is setup, please review how we recommend making template changes in Customization Best Practices.
Then add the following code on your child theme’s functions.php file:
function x_get_content_layout() { $content_layout = x_get_option( 'x_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_page_template( 'template-layout-content-sidebar.php' ) ) { $layout = 'content-sidebar'; } elseif ( is_page_template( 'template-layout-sidebar-content.php' ) ) { $layout = 'sidebar-content'; } elseif ( is_page_template( 'template-layout-full-width.php' ) ) { $layout = 'full-width'; } elseif ( is_archive() ) { if ( x_is_shop() || x_is_product_category() || x_is_product_tag() ) { $opt = x_get_option( 'x_woocommerce_shop_layout_content', 'sidebar' ); $layout = ( $opt == 'sidebar' ) ? $content_layout : $opt; } else { $opt = x_get_option( 'x_archive_layout', 'sidebar' ); $layout = ( $opt == 'sidebar' ) ? $content_layout : $opt; } } elseif ( x_is_product() ) { $layout = 'content-sidebar'; } 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; } return $layout; }Hope this helps.
April 19, 2016 at 10:00 am #890197
rkcreaghParticipantHi Lely, I’ve made the change, and it sort of worked. The product page layout now has the space for a sidebar, but it’s on the right side, and there’s no sidebar there, just empty space.
April 19, 2016 at 7:21 pm #890979
NicoModeratorHi There,
To assist you with this issue, we’ll first need you to provide us with your URL. This is to ensure that we can provide you with a tailored answer to your situation. Once you have provided us with your URL, we will be happy to assist you with everything.
Thanks.
April 21, 2016 at 12:31 pm #894059
rkcreaghParticipantThis reply has been marked as private.April 22, 2016 at 2:20 am #894892
LelyModeratorHello Ryan,
To move the sidebar on the left side please update the code to this:
function x_get_content_layout() { $content_layout = x_get_option( 'x_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_page_template( 'template-layout-content-sidebar.php' ) ) { $layout = 'content-sidebar'; } elseif ( is_page_template( 'template-layout-sidebar-content.php' ) ) { $layout = 'sidebar-content'; } elseif ( is_page_template( 'template-layout-full-width.php' ) ) { $layout = 'full-width'; } elseif ( is_archive() ) { if ( x_is_shop() || x_is_product_category() || x_is_product_tag() ) { $opt = x_get_option( 'x_woocommerce_shop_layout_content', 'sidebar' ); $layout = ( $opt == 'sidebar' ) ? $content_layout : $opt; } 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; } return $layout; }I’ve changed this part:
} elseif ( x_is_product() ) { $layout = 'content-sidebar';To this:
} elseif ( x_is_product() ) { $layout = 'sidebar-content';For the content to appear please add widgets on Appearance > Widget > Main Sidebar. Depeding on what you want to see on the sidebar, drag the widgets.
Hope this helps.
April 22, 2016 at 11:25 am #895579
rkcreaghParticipantworks perfect, thanks so much!
April 23, 2016 at 3:34 am #896432
Nabeel AModeratorGlad we could help 🙂
Cheers!
-
AuthorPosts
- <script> jQuery(function($){ $("#no-reply-888903 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>
