• Hi,

    I would like to remove the sidebar on my front page but leave it on the rest of my pages. I tried setting my front page as a static page and making sure that the static page I chose under Reading settings was using the full width template, but that didn’t work. For some reason, any page that I set to the front page is displayed with a sidebar. It’s like whatever template I chose for the page is over-ridden when I set it as the front page.

    I found that I can edit style.css to basically hide the sidebar by changing its width to 0%, but doing this hides the sidebar on all of my pages, and that’s not what I want to do.

    Any suggestions on how to make this work?

    Thanks!

Viewing 7 replies - 1 through 7 (of 7 total)
  • Hristo Pandjarov

    (@hristo-sg)

    SiteGround Representative

    There are many ways to achieve this but here’s one.

    1. Open the index.php file of your theme and locate the line that includes the sidebar.php file. It should look something like this:

    <?php get_sidebar(); ?>

    2. Replace that part with a conditional statement:

    <?php
    if (!is_home() ) {
    	get_sidebar();
    }
    ?>
    Thread Starter seenandnotseen

    (@seenandnotseen)

    Hi,

    Thanks for your response! Will this code make the sidebar appear only on the front page? I would like to make the sidebar NOT appear on the front page, but still appear on other pages. Can I modify this code to do that?

    Thanks!

    Thread Starter seenandnotseen

    (@seenandnotseen)

    I should note that as well as removing the sidebar, I am also trying to make the main contents of the page stretch out to fill up the space that was taken up by the sidebar.

    I have found that I can achieve this “stretch” by editing the width of the content area and the sidebar in style.css, so that the sidebar is 0% wide. The problem with that, though, is that (as I understand it) style.css governs all posts and pages, etc., so when I change that it effectively hides the sidebar on all of my pages, which I don’t want.

    Now, this would not be an issue if I could just make my front page full width and have that take care of it, but as I mentioned earlier, for some reason setting a page to full width doesn’t work when I use it as my front page.

    So I guess my other question is: Is there also a way that I can either A) change the width of the content area and sidebar on JUST a specific page so that my content stretches all the way across, and have that hold true even when I use that page as my front page, or B)somehow get the full width template setting to work / show up on a page that I use as my front page?

    I hope this makes sense.

    Also, If there is a way for the theme author to update the theme so that we can use the full width template on front pages, that would be really helpful!

    (I don’t know enough about the code or about WordPress to know whether this is a problem that is specific to this theme or whether it is just something that is unavoidable in WordPress).

    Thread Starter seenandnotseen

    (@seenandnotseen)

    Here’s an excerpt of the code in style.css showing where I was able to modify the width of the main content area and the sidebar:

    In the “Page Content” section:

    article.content{
    width: 65%; /* <—- I changed this to 96% */
    float: left;
    margin-bottom: 40px;
    padding-right: 1.5%;
    border-right: 1px solid #f2f2f2;
    }

    And in the “Sidebar” section:

    aside.sidebar{
    width: 31%; /* <—- I changed this to 0% */
    /*margin-top: 1em;*/
    padding: 0 0 0 2%;
    float: right;
    }

    Theme Author Slocum Studio

    (@slocumstudio)

    Hi seenandnotseen,

    We think this may be the best solution for removing the sidebar from the front page template on our Epic theme:

    Since you are aware of Child Themes, according to another post, you could copy the front-page.php template to your Child Themes’s directory and remove the get_sidebar() function. You’ll also want to add a CSS class of full-width-content-wrapper to the <section class="content-wrapper front-page-content front-page cf"> element. That CSS class will make your content stretch across the layout as requested.

    We are aware that setting a template on the front page does not currently work as intended and will include a fix for this in a future version of Epic.

    Hope this helps!

    Thank You

    Thread Starter seenandnotseen

    (@seenandnotseen)

    Hi Slocum Design Studio,

    Thanks so much for your help!

    I just have one question.

    Regarding what you said here:

    “You’ll also want to add a CSS class of full-width-content-wrapper to the <section class=”content-wrapper front-page-content front-page cf”> element. That CSS class will make your content stretch across the layout as requested.”

    Can you be more specific about how to do this? I’m very new to both CSS and php. Where should I put the text “full-width-content-wrapper” within this part of front-page.php?:

    <section class=”content-wrapper front-page-content front-page cf”>

    Thank you again!

    Theme Author Slocum Studio

    (@slocumstudio)

    Hi seenandnotseen,

    You’re very welcome! You should change: <section class="content-wrapper front-page-content front-page cf"> to <section class="content-wrapper front-page-content front-page full-width-content-wrapper cf">.

    Notice we’ve added the full-width-content-wrapper class to that section element.

    Thank you for using Epic!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Remove sidebar from front page only?’ is closed to new replies.