-
AuthorPosts
-
July 8, 2015 at 3:12 am #324068
rosskilleenParticipantHi there,
From an older thread here I got some code to make the sidebar appear on the single product page in woocommerce. However, it is appearing on the wrong side of the page. I have the theme set to show content on right and sidebar on left which it does everywhere else on the site, except these pages. Also, the search box within the sidebar has become too long for the border of the sidebar.
Hope you can help.
Many thanks
Ross
July 8, 2015 at 4:51 am #324135
Paul RModeratorHi Ross,
Can you share the code you have copied from the forum and provide us your site url
so we could take a closer look.Thanks
July 8, 2015 at 7:18 am #324251
rosskilleenParticipantHi there,
Many thanks for your reply. URL is http://lightsign.ie/product/professional-screens/philips-32-professional-display-screen-bdl3250el/
Code is below:
if ( ! function_exists( ‘x_get_content_layout’ ) ) :
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() ) {
$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_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 = ‘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’;
}return $layout;
}
endif;Very best,
Ross
July 8, 2015 at 8:26 am #324314
Paul RModeratorHi Ross,
Please replace your code with 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; }Hope that helps.
July 9, 2015 at 4:19 am #325414
rosskilleenParticipantHi there,
Thanks a mil, the code seems to have worked for the sidebar positioning, however the search box is extending way beyond the border: http://lightsign.ie/product/professional-screens/philips-32-professional-display-screen-bdl3250el/
I was also wonder if it was possible to show the categories in the breadcrumbs. When you are in parent category or sub-categoy, the breadcrumbs appear fine:
home > products > parent category > sub-category
But when you are in the single product page the categories disappear and the breadcrumbs appear like:
home > products > single product
Is there a way to show the parent and sub categories before the product?
Thanks for all your help and attention.
Very best,
Ross
July 9, 2015 at 5:27 am #325456
Paul RModeratorHi Ross,
To fix the search overflowing, you can add this under Custom > CSS in the Customizer.
.widget_product_search form input[type="search"] { -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; }With regards to product categories
I’m sorry, I’m afraid there isn’t a simple way to do this right now. It would require a good deal of modification to the breadcrumbs function (x/framework/functions/global/breadcrumbs.php) This is a good idea though. We’ll add it to a list a feature requests for consideration in future development.
Thanks
July 9, 2015 at 8:34 am #325593
rosskilleenParticipantOk no problem, thanks a mil for the search box fix.
Very best,
Ross
July 9, 2015 at 10:42 am #325695
RupokMemberYou are welcome Ross!
Glad that it helped. Feel free to let us know if you face any other issue. We’ll be happy to assist you.
Thanks for using X.
Cheers!
July 10, 2015 at 7:56 am #326648
rosskilleenParticipantHi there,
Sorry to be a pain! Two product pages are randomly displaying the sidebar at the very bottom of the page and I can’t see any difference between these and the pages that display it in the correct position. URLs are as follows:
http://lightsign.ie/product/media-players/aopen-de3100-basic-media-player/
http://lightsign.ie/product/media-players/aopen-digital-engine-de6140-media-player/Hope you guys can help.
Many thanks
Ross
July 10, 2015 at 8:45 am #326692
Paul RModeratorHi Ross,
It looks like there are excess div tags on those pages.
Would you mind providing us with login credentials so we can take a closer look? To do this, you can make a post with the following info:
– Link to your site
– WordPress Admin username / passwordDon’t forget to select Set as private reply. This ensures your information is only visible to our staff.
July 12, 2015 at 3:45 am #327683
rosskilleenParticipantThis reply has been marked as private.July 12, 2015 at 4:04 am #327689
ChristopherModeratorHi there,
Before we continue, we need you to update X and VC, install Cornerstone from X Addons -> Extensions and disable X shortcodes plugin.
Then if you still have issue please update the code in functions.php to :
//Add sidebar to single product // ============================================================================= if ( ! function_exists( 'x_get_content_layout' ) ) : function x_get_content_layout() { $stack = x_get_stack(); $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() || x_is_product() ) { $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_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; } endif;Hope it helps.
-
AuthorPosts
- <script> jQuery(function($){ $("#no-reply-324068 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>
