Tagged: x
-
AuthorPosts
-
December 7, 2016 at 11:58 am #1284882
yanikphotoParticipantHello
My site has content layout default set to “fullwidth” but I want a sidebar just on the main blog page and blog posts. How do I do this? Changing the content layout default set to “content left – sidebar right” isn’t an option as I would have to manually go in and change 100s of pages back to “fullwidth”.
Thanks!
December 7, 2016 at 1:13 pm #1284965
RahulModeratorHi There,
Thanks for writing in! 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 again!
December 9, 2016 at 11:13 am #1287554
yanikphotoParticipantThere you go!
December 9, 2016 at 1:49 pm #1287692
JadeModeratorDecember 12, 2016 at 1:36 pm #1290369
yanikphotoParticipantThis reply has been marked as private.December 12, 2016 at 11:36 pm #1290836
LelyModeratorHello Yanik,
Thank you for the credentials.
Your settings is correct. Please try to clear cache and then try to check again. We might be seeing cache content.December 13, 2016 at 8:24 am #1291328
yanikphotoParticipantHello
I already have the blog index page to not cache but I cleared my cache as well and tried a different browser and the side bar doesn’t show.
Please help.
December 13, 2016 at 9:49 am #1291441
JoaoModeratorHi There,
In That case, please go to Appereance > Customizer > Layout and design and choose the general layout with Side Bar.
On the pages you dont want a sidebar, click Edit Page > On your WordPress classic admin bar > Under the blue update button you can choose the template Blank No Container Header Footer.
Hope that helps
Joao
December 13, 2016 at 10:47 am #1291523
yanikphotoParticipantHi
As I mentioned before, this isn’t an option as I have 100s of pages that I would need to do this on.
Isn’t there another simple solution?
December 13, 2016 at 8:50 pm #1292208
LelyModeratorHi There,
Please update the code on your child theme’s functions.php file 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' ) ) { $layout = 'content-sidebar'; } 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 = 'full-width'; } 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 { if ( is_home() || is_singular( 'post' ) ) { $layout = 'content-sidebar'; else{ $layout = $content_layout; } } return $layout; }Hope this helps.
December 14, 2016 at 8:24 am #1292750
yanikphotoParticipantThat code broke my site. My home page was blank.
December 14, 2016 at 9:39 am #1292866
LelyModeratorHi There,
We’re sorry for the inconvenience this has caused you. I missed one closing bracket. This updated code should work now:
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' ) ) { $layout = 'content-sidebar'; } 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 = 'full-width'; } 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 { if ( is_home() || is_singular( 'post' ) ) { $layout = 'content-sidebar'; }else{ $layout = $content_layout; } } return $layout; }December 14, 2016 at 9:48 am #1292874
yanikphotoParticipantThat didn’t work either. many pages were still blank including the blog page.
December 14, 2016 at 3:15 pm #1293315
RadModeratorHi there,
The code is okay, checked it on my installation. Maybe you’re breaking existing code while adding it.
Please set WP_DEBUG to true under your site’s wp-config.php, and add the code and test it again. Then provide any error you get and make sure you’re appending the code, and no replacing the entire content of functions.php
And please provide your FTP login credentials as well.
Thanks!
December 15, 2016 at 7:45 am #1294197
yanikphotoParticipantThis reply has been marked as private. -
AuthorPosts
- <script> jQuery(function($){ $("#no-reply-1284882 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>
