Tagged: x
-
AuthorPosts
-
March 31, 2016 at 10:43 am #860984
I set the global setting to a content left/sidebar right with hopes I could override all my ‘regular’ pages with a ‘full page layout setting’, and still achieve a right sidebar on my blog page. No can do – all pages still show that pesky sidebar, even when overriding in the page settings. I’ve tried every combination i can think of to get a sidebar, or even a right side widget area in my blog page (current redirected to another page on the side away from the home page) while still maintaining layout as full page everywhere else. Suggestions?
site: http://www.cjchrservices.dreamhosters.com/index.php/hr-news/March 31, 2016 at 8:30 pm #861753Hi Corinne,
Thanks for writing in.
Maybe this code will able to help you, please add this to your child theme’s functions.php
function x_get_content_layout() { $content_layout = x_get_option( 'x_layout_content' ); if ( $content_layout != 'full-width' ) { if ( 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() ) { $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 ( 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 ( 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; }
This change will prioritize the blog and page template’s layout than the global layout.
Thanks!
April 1, 2016 at 2:49 pm #863015this is the only way to get a sidebar added to my blog page? i really don’t want to work with a child theme if it can be avoided
April 2, 2016 at 3:13 am #863587Hello Corrine,
Yes there is a way. Please follow these steps:
1] Please set again the global setting to a content left/sidebar right. This setting can be found in your customizer, Appearance > Customize > Layout & Design > Content Layout
2] And then please go to Appearance > Customize > Blog > Layout and make sure that it is set as “Use Global Content Layout”
3] Now that you have set the global layout settings, you can override the global layout settings in each of your pages by editing the page itself and make sure to select the “Layout – Fullwidth” page template. Please keep in mind that the default page template is dependent to the global layout settings. Choosing a page template will ensure that all you pages will have a fullwidth layout and that no sidebar will be displayed. And one more thing; the page template will be ignore when you assign a page as your Post Page.
Hope this helps.
April 2, 2016 at 1:25 pm #863982This does help. I tried that initially and for some reason it didn’t work. Works perfectly now – you guys rock.
April 3, 2016 at 2:25 am #864433Glad we could help you with this.
-
AuthorPosts