• I searched around and found there was a lot of people with the same problem as me, which was how to remove the left-side black sidebar. There seemed to be a lot of confusion over how this was done and a lot of people gave really complicated solutions.

    I am new to WordPress and by no means an expert but I resolved the issue under my own steam and found a fairly simple solution.

    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.

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

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

    I hope these solutions work for people. If so please comment so others can also take advantage of this problem.

Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘HOW TO: 2014 theme – Remove Sidebar from Homepage or all pages [SOLUTION]’ is closed to new replies.