• Resolved elenikap

    (@elenikap)


    Hi, i would like to remove the sidebars from the posts. Is it possible? I would like to have full width posts!! Any help???

Viewing 14 replies - 1 through 14 (of 14 total)
  • Cousett

    (@cousett)

    Sometimes this is an option within the theme which theme are you using?

    Thread Starter elenikap

    (@elenikap)

    I am using the sixteen theme and it doesn’t have an option! maybe i can do something with the css??

    nacinla

    (@nacinla)

    I’ve been working on this also. I put a copy of the “single.php” file in my child theme folder and deleted the sidebar-related php. That got rid of the sidebar, but I was not able to get my child style.css file to stretch the #primary.content-area wider. I used the “Inspect Element” method to see the div and change the value temporarily, but for some reason adding that revised code to child css doesn’t work. Seems like someone could chime in here and provide and answer. I’ll keep working on it.

    Cousett

    (@cousett)

    nacinla, if you know what CSS you need to add to stretch out the #primary.content-area div then you might look at one of the CSS editing plugins as an easy way to inject some custom code into the theme.

    Jetpack has an “Edit CSS” feature.
    Improved Simpler CSS is also a popular plugin for this need.

    Without knowing your site or child theme setup it’s hard to say why your CSS in your child theme isn’t loading.

    Cousett

    (@cousett)

    elenikap, ok you’re right. The sixteen theme doesn’t have an option to disable the sidebar. But it does have a spot where you can add custom CSS code. Removing the sidebar from the posts is pretty simple with this theme. Just add the CSS code below to the Appearance→Sixteen Settings→Custom CSS section:

    #primary {
    width: 100%;
    }
    
    #secondary {
    display: none;
    }

    nacinla

    (@nacinla)

    Thanks, Cousett. My child style sheet is up and working! And your suggestion got rid of the secondary (sidebar) element. But I still can’t get the primary element to behave correctly. When I change it to width:98% in the Inspector’s rules window, it works fine. When I inserted this code into my child.css at top, it doesn’t work, even with the !important designation.

    #primary {
    width: 98% !important;
    }

    #secondary {
    display: none;
    }
    So I then inserted it in SixteenSettings>LayoutSettings>Custom CSS and it works fine. I just have to figure out what file that code is being written to because it’s apparently third in the cascade, overriding the main and my child css. Now all I need to do is get the featured images to be bigger and I’m pretty much done with customizing…. Thanks!

    Cousett

    (@cousett)

    To stretch the featured image out across the post you might try

    .single-post .featured-image-single img {
      width: 100%;
    }
    nacinla

    (@nacinla)

    Thanks, cousett. I actually hid the display of the featured photo on the post page itself and we will manually reinsert those in the size and place we want. 100% width would work if the photo is a horizontal we want that big, but not, say, for a vertical.

    Thread Starter elenikap

    (@elenikap)

    This worked just fine!! thank you very much everybody!!!

    Toni

    (@tools4toni)

    Ooops, This got rid of the sidebar everywhere. Not just the post pages. So nevermind…

    This is amazing! I have seen all this PHP to remove the sidebar in posts pages. The CSS above worked great! Base WP theme.

    I just threw it in a child theme like it was written:
    #primary {
    width: 100%;
    }

    #secondary {
    display: none;
    }

    Thanks!

    INserting cousett’s code to Appearance→Sixteen Settings→Custom CSS section removed my sidebar from everywhere. How can i get rid of it ONLY on post page?

    Toni

    (@tools4toni)

    If you are desperate follow me. You will be able to do much more too. I am not a developer/programmer, I can only copy/paste CSS. I just looked around and guessed. It worked the first time – I did no damage because it is not possible.

    Summary of steps:

    This is super easy with a plugin Child Theme Configurator. Steps- create child theme, look at single post PHP file, go copy file using a check box and hit a button, delete one code line and save.

    With this plugin Child Theme Configurator – you can find and change/edit files without touching the Parent Theme files. Screw up? Fix or trash and try again. I did it easily the first time.

    1). I had to create child theme with
    Child Theme Configurator (I did note fill in a bunch of boxes – I just created a child theme by pressing the button.)

    2). Look for the PHP file that is for the single post page with sidebar:
    Go to the Themes/”Theme Editor” (from Admin Themes menu) to access PHP files. I found the file for posts, and then where it called in the sidebar in that file. Remember the name of that file.

    3). Copy the PHP file to your child theme:
    Go to Themes/”Child Themes” (from Admin Themes menu) Child Theme Configurator interface.
    – Go to “Files” tab
    – see “Parent Templates” Find the PHP file in the list, check the box to select it.
    – Press “Copy Selected To Child Theme”

    4). Delete sidebar line of code
    – Go to back to Themes/”Editor”
    – Select your child theme from the dropdown
    – Find/choose post PHP file in list ( there will only be 3 files there)
    – Find and delete code line that calls the sidebar
    – Save

    Try out the Child Theme.

    Find other stuff to change beyond CSS.

    Toni

    (@tools4toni)

    Oh I need to add that you need to change the spacing – the width of the posts.

    Toni

    (@tools4toni)

    I got the proper width, but images do not center correctly.

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘Remove sidebar from the posts’ is closed to new replies.