- This topic has 2 replies, 2 voices, and was last updated 8 years, 8 months ago by heather.
-
AuthorPosts
-
August 15, 2015 at 6:08 am #63846heatherParticipant
Hi,
Thanks for the help with putting the title over the header image – it is looking great.I have run into something else I am hoping you can give me a solution to. For the site in general I have Theme Options > Layout Option > Default Layout set to No Sidebar (Content Width) which works well for everything except Single Blog Posts. I have specific sidebar content that should only appear in the blog section and was hoping you might be able to provide the correct code for me to override the site default for the Post content type so that authors don’t always have to open and set it in the Full Frame options when they blog. I was thinking it might be as easy as adding a conditional statement to my child theme function.php or sidebar.php?
Let me know if you think this is possible and how to go about it.
Thanks!
heatherAugust 15, 2015 at 8:33 am #63856SakinKeymaster@heather: due to log of conditions there is no such easy way to do it. The best option will be to Set Default with sidebar. As there is more posts then pages. Then you can go to pages and edit it option to set as No Sidebar.
If you really want to do it from child theme then copy sidebar.php file to your child theme and then replace the following code:
// WooCommerce Shop Page excluding Cart and checkout if ( class_exists( 'woocommerce' ) && is_woocommerce() ) {
with
if ( is_single() ) { $layout = 'right-sidebar'; $sidebaroptions = 'right-sidebar'; } // WooCommerce Shop Page excluding Cart and checkout elseif ( class_exists( 'woocommerce' ) && is_woocommerce() ) {
Then copy the function fullframe_body_classes() to your child theme functions.php file and then edit the following code:
// WooCommerce Shop Page if ( class_exists( 'woocommerce' ) && is_woocommerce() ) {
with
if ( is_single() ) { $layout = 'right-sidebar'; } // WooCommerce Shop Page elseif ( class_exists( 'woocommerce' ) && is_woocommerce() ) {
August 18, 2015 at 5:28 am #64267heatherParticipantPerfect, thanks.
Actually I went the route I did because at least for launch there will be many more site pages needing fullwidth than blog posts 🙂 I am dearly hoping they can scrape up 6 posts for launch, but moving forward they will benefit from not having to set sidebar manually. Eventually 🙂
Thanks again.
-
AuthorPosts
- The topic ‘Override sitewide default layout for Blog posts only?’ is closed to new replies.