[Resolved] Customizing Blog Templage For Only Home Page

Home Forums Support [Resolved] Customizing Blog Templage For Only Home Page

Home Forums Support Customizing Blog Templage For Only Home Page

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #696124
    Bud

    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

    GeneratePress 2.1.4
    GP Premium 1.7.2
    #696275
    David
    Staff
    Customer Support

    Hi 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:

    https://wordpress.org/plugins/content-aware-sidebars/

    #696291
    Bud

    Hi 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

    #696306
    David
    Staff
    Customer Support

    The 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?

    #696358
    Bud

    David

    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

    #696374
    Bud

    No 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

    #696392
    David
    Staff
    Customer Support

    You’re welcome – keep us posted 🙂

    #697858
    Bud

    David

    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

    #698111
    David
    Staff
    Customer Support

    Hi 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.

Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.