- This topic has 8 replies, 2 voices, and was last updated 5 years, 6 months ago by David.
-
AuthorPosts
-
October 8, 2018 at 7:19 am #696124Bud
Hi Tom
Very new to GP but I love it. I can’t believe the features you have packed into it. You really understand what people need and are light years ahead of everyone.
Your documentation is amazing. I looked everywhere for an answer to my question before I contacted you.
I’m handy with CSS not so much with PHP.
I’m working on a site that uses the standard blog template for the home page which is set to latest post. I have several category archive pages as well.
How do I change the blog template so that it will not display a sidebar and in its place I want to add a video just for the home page? (I want to leave the blog template as is for the category archive pages.)
Thank you so much.
Bud
October 8, 2018 at 8:37 am #696275DavidStaffCustomer SupportHi Bud,
Thanks for the great feedback.
you can use the Layout Element to remove the sidebar from different pages, in your case the Display rule would be the Front Page:https://docs.generatepress.com/article/layout-element-overview/
But maybe a better alternative would be to use something like Content Aware Sidebars:
October 8, 2018 at 9:03 am #696291BudHi David
Thanks for your quick response but that’s not the answer because we’re not dealing with a page but the post template. Seems like you need to add a filter or an action in functions.php to get this done.
I am familiar with Content Aware Sidebars but that won’t work for the same reason. i needto modify the blog template (probably index.php) which – as you know – has nothing to do with pages.
Bud
October 8, 2018 at 9:19 am #696306DavidStaffCustomer SupportThe Layout Element allows you to disable elements even on archives / blog pages / front page. Its not restricted like the meta box in the page editor. Problem is in removing the sidebar also removes the before_sidebar_content hook so we can’t add the video there.
I am not sure what the problem is with using a dynamic sidebar plugin? You could set the video to be only displayed for the front page and set the condtions for the other widgets?
October 8, 2018 at 10:06 am #696358BudDavid
I tried that before but ti does not work,
Here is what I just did.
1. Created a page and called it “blog”
2. Chose that page to be my post page. (I did not select any page to be Home Page as I need that to be the Home Page.
3. Tried changing to Layout options like no sidebars or sidebar/content but no matter which option is picked I get the default (content/sidebar).Am I doing what you suggested?
If so, I will look into using CAS.
Bud
October 8, 2018 at 10:14 am #696374BudNo need to reply for now.
Just had a look at CAS which I have used and I think that will do the trick.
IF not, I’ll have to get back to you.
Thanks for your help.
Bud
October 8, 2018 at 10:28 am #696392DavidStaffCustomer SupportYou’re welcome – keep us posted 🙂
October 10, 2018 at 6:48 am #697858BudDavid
Here is what I did after seeing the doc on sidebars.
#Removes sidebar home page (blog)
add_filter( ‘generate_sidebar_layout’,’bk_custom_home_sidebar_layout’ );
function bk_custom_home_sidebar_layout( $layout )
{
// If we are on the home page, set the sidebar
if ( is_home() )
return ‘no-sidebar’;// Or else, set the regular layout
return $layout;}
Then I set up a header element to include content below the primary and above the blog post excerpts.
Perfect. Just what I wanted.
I love GP and will use it on as many projects as I can.
Bud
October 10, 2018 at 9:55 am #698111DavidStaffCustomer SupportHi Bud,
that sounds great. Glad you found the solution.
You may want to investigate the Layout Element – which provides the same controls you have applied with the PHP.https://docs.generatepress.com/article/layout-element-overview/
Unlike the Layout and Disable Elements meta in the post editor, which does not work on a blog or archive because WP ignores them, this does.
-
AuthorPosts
- You must be logged in to reply to this topic.