Tagged: x
-
AuthorPosts
-
June 25, 2016 at 4:28 pm #1059481
nextstepsyepParticipantGreetings X Fam,
I am in love with the X theme. All has been going swimmingly well but I’ve managed to hit a roadblock. I finally found function code from a previous X forum to get sidebars to appear on my WooCommerce pages at full-width. Unfortunately, the code affects all of my home pages and shows a blank sidebar space where there should be none.
Can anyone help? Here’s the code I copied into my function.php child theme for my website http://www.nextstepsyep.org:
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() ) {
$layout = ‘content-sidebar’;
} 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;
}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;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 );
June 25, 2016 at 10:31 pm #1059730
Rue NelModeratorHello There,
Thanks for writing in! To assist you better with this issue, would you mind providing us the url of your site with login credentials so we can take a closer look? 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.
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.
Thank you.
June 28, 2016 at 8:48 am #1063201
nextstepsyepParticipantThis reply has been marked as private.June 28, 2016 at 8:49 am #1063202
nextstepsyepParticipantThis reply has been marked as private.June 28, 2016 at 9:05 am #1063226
ChristopherModeratorHi there,
Please select one of layouts with sidebar under Customize -> Layout and design.
Select shop page under Wocommerce settings -> Products -> Display.Thanks.
June 28, 2016 at 9:43 am #1063297
nextstepsyepParticipantGreetings Christopher,
I had just taken the site down to try to make some more revisions. Was not expecting you to respond so quickly! You now have my undivided attention. 🙂
The Fab Lab shop page is back visible @ http://nextstepsyep.org/college-town/cooperative-marketing/shop/
Layout: I definitely want to keep it full width.
June 28, 2016 at 3:52 pm #1063869
nextstepsyepParticipantThis reply has been marked as private.June 28, 2016 at 9:20 pm #1064223
LelyModeratorHi There,
To add sidebar on woocommerce shop page only, please add this code instead on your child theme functions.php file:
function x_get_content_layout() { $content_layout = x_get_option( 'x_layout_content' ); if ( $content_layout != 'full-width' ) { if ( is_home() ) { $opt = x_get_option( 'x_blog_layout' ); $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' ); $layout = ( $opt == 'sidebar' ) ? $content_layout : $opt; } else { $opt = x_get_option( 'x_archive_layout' ); $layout = ( $opt == 'sidebar' ) ? $content_layout : $opt; } } elseif ( x_is_product() ) { $layout = 'full-width'; } elseif ( x_is_bbpress() ) { $opt = x_get_option( 'x_bbpress_layout_content' ); $layout = ( $opt == 'sidebar' ) ? $content_layout : $opt; } elseif ( x_is_buddypress() ) { $opt = x_get_option( 'x_buddypress_layout_content' ); $layout = ( $opt == 'sidebar' ) ? $content_layout : $opt; } elseif ( is_404() ) { $layout = 'full-width'; } else { $layout = $content_layout; } } else { $layout = $content_layout; } if ( x_is_shop() ) { $layout = 'content-sidebar'; } return $layout; }To display Fab Lab Sidebar, please copy wp-sidebar.php from wp-content\themes\x\framework\views\integrity to this folderwp-content\themes\x-child\framework\views\integrity.
Open the copied file and replace the entire code with the following:
<?php // ============================================================================= // VIEWS/INTEGRITY/WP-SIDEBAR.PHP // ----------------------------------------------------------------------------- // Sidebar output for Integrity. // ============================================================================= ?> <?php if ( x_get_content_layout() != 'full-width' ) : ?> <aside class="<?php x_sidebar_class(); ?>" role="complementary"> <?php if (x_is_shop() ) : ?> <?php dynamic_sidebar('ups-sidebar-shop' ); ?> <?php endif; ?> <?php if ( get_option( 'ups_sidebars' ) != array() ) : ?> <?php dynamic_sidebar( apply_filters( 'ups_sidebar', 'sidebar-main' ) ); ?> <?php else : ?> <?php dynamic_sidebar( 'sidebar-main' ); ?> <?php endif; ?> </aside> <?php endif; ?>Hope this helps.
June 29, 2016 at 3:10 pm #1065448
nextstepsyepParticipantWoot, Woot! Almost there Lely 🙂
There are just five more things that will make all my Fab Lab dreams come true:
1. Removing the duplicate sidebar.
2. Relocating the sidebar to the left side instead of the right side.
3. Getting rid of that bullet thingy in my widget menu
4. Teaching me how to get that space above the Welcome To The Fab Lab header for banners
5. Having the sidebar appear on the catalog archives pages as well.Model| amazon.com (A girl can dream, right?)
https://www.amazon.com/s/ref=gw_in_av_smr/187-3921423-0710152?_encoding=UTF8&bbn=10445813011&rh=n%3A7141123011%2Cn%3A10445813011%2Cn%3A7147440011%2Cn%3A1040660%2Cn%3A1045024&pf_rd_m=ATVPDKIKX0DER&pf_rd_s=&pf_rd_r=0FE7XGTZN494B5SHXMRH&pf_rd_t=36701&pf_rd_p=4301bdc7-c526-4439-9945-c3d07b830d38&pf_rd_i=desktopCan you get me there?
June 29, 2016 at 8:42 pm #1065903
LelyModeratorHi There,
1.) and 5.)Please try to update wp-sidebar.php to this:
<?php // ============================================================================= // VIEWS/INTEGRITY/WP-SIDEBAR.PHP // ----------------------------------------------------------------------------- // Sidebar output for Integrity. // ============================================================================= ?> <?php if ( x_get_content_layout() != 'full-width' ) : ?> <aside class="<?php x_sidebar_class(); ?>" role="complementary"> <?php if (x_is_shop() || x_is_product_category() ) : ?> <?php dynamic_sidebar('ups-sidebar-shop' ); ?> <?php endif; ?> <?php if ( get_option( 'ups_sidebars' ) != array() ) : ?> <?php if (!x_is_shop() && !x_is_product_category() ) : ?> <?php dynamic_sidebar( apply_filters( 'ups_sidebar', 'sidebar-main' ) ); ?> <?php endif; ?> <?php else : ?> <?php dynamic_sidebar( 'sidebar-main' ); ?> <?php endif; ?> </aside> <?php endif; ?>2.) and 5.) Update the code that we have added on your functions.php file:
Look for this part of the code near the end:if ( x_is_shop()) { $layout = 'content-sidebar'; }Update that part to this:
if ( x_is_shop() || x_is_product_category()) { $layout = 'sidebar-content'; }3.) There’s no bullet on the widget when I checked. See attached screenshot.
4.) Please clarify what you want to achieve here so we can be more specific on our suggestion.Hope this helps.
June 30, 2016 at 10:28 pm #1067862
nextstepsyepParticipantGreetings Lely,
I don’t have to tell you how awesome you are but I hope you stay this way forever!!!
I’ve made the changes and am hopeful they’ve gotten me one step closer to becoming fabulous. Unfortunately, Hostgator’s got some strong wonkiness going on that’s 404-ing me on my website so I’ll have to spike the football for you a little later.
In anticipation of all things going as planned, I do appreciate all your help.
Soon,
D. JewelJuly 1, 2016 at 12:47 am #1067985
LelyModeratorYou’re welcome D. Jewel!
Cheers!
-
AuthorPosts
- <script> jQuery(function($){ $("#no-reply-1059481 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>
