• Hey, Im trying to figure out how to remove the sidebar on my homepage only & found this thread while searching for an answer… I’ve created a blank page for my homepage, copied the header.php to my child theme, and understand steps 2 & 3, but no have no idea how to assign the class homepage to the homepage in step 1. Ive looked through my header.php file and do no see that specific code he references. Can someone please walk me through step 1 or provide another solution if unsure about the solution provided below. My theme is Arcade Basic – thanks so much!!

    IMPORTANT! Both solutions lined out below require you to assign a page as your homepage in Settings->Reading->Front page displays, in the Admin area.

    Remove Sidebar from Homepage only
    I only wanted to remove it from the homepage so here is how I did that.

    1. Assign the class ‘homepage’ to the homepage. In header.php replace line:
    <div id=”page” class=”hfeed site”>
    with:
    <div id=”page” class=”hfeed site<?php if(is_front_page()){ echo ‘ homepage’; } ?>”>

    This will then add another class to this line only for the homepage.

    2. In page.php replace the line:
    get_sidebar();
    with:
    if(!is_front_page()){
    get_sidebar();
    }
    This will then prevent the sidebar content being called on the homepage.

    3. Add the follow 2 styles to your style.css stylesheet:
    .homepage:before {
    display: none;
    }
    .homepage .site-content {
    margin-left: 0px;
    }
    These 2 styles will then only be assigned to the homepage. The first style removes the black background of the sidebar, whilst the second aligns the content to the left side remove the big margin.

    Remove from ALL pages
    I have not used this solution so cannot comment on its working but it should be fine.

    In page.php replace the line:
    get_sidebar();
    with:
    if(!is_front_page()){
    get_sidebar();
    }
    This will then prevent the sidebar content being called on the homepage.

    Add the follow 2 styles to your style.css stylesheet:
    #page:before {
    display: none;
    }
    #page .site-content {
    margin-left: 0px;
    }
    These 2 styles will then only be assigned to the homepage. The first style removes the black background of the sidebar, whilst the second aligns the content to the left side remove the big margin.

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)

The topic ‘Remove sidebar on homepage only (Arcade Basic Theme)’ is closed to new replies.