• Resolved shewenttospain

    (@shewenttospain)


    For just a single post, I want to remove the sidebar and make the whole post 100% wide. I used this WordPress tutorial to create a single post template in my child theme to remove the sidebar, but now there’s just a blank space where the sidebar used to be. When I inspect it in preview mode, I can change the width from 63% to 100% but it doesn’t save. How can I stretch the main content area across the screen (and keep it responsive)?

Viewing 5 replies - 1 through 5 (of 5 total)
  • AddWeb Solution

    (@addweb-solution-pvt-ltd)

    Hello shewenttospain,

    Add below code into active child theme’s style.css file.

    Note : Don’t modify your theme. Use child theme for any modification.


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

    Hope this will helps you.

    Thanks!

    Ok, here is what you can do in your single.php or the single template you have created for your specific post type, for example: single-article.php

    1. Open your the single template you created in edit mode and add a class named full-stretch to the main tag here (you can use any name):
    <main id="main" class="site-main <strong>full-stretch</strong>" role="main">

    2. Comment out this line: <?php get_sidebar(); ?>, this will stop rendering your default sidebar.

    3. save the file and refresh your browser. Nothing visible you would see except the sidebar should now disappear leaving an empty whitespace. The content area will still remain the same.

    4. Go to Appearance > Customize > Additional CSS and add this:

    
    .full-stretch{
      width: 100% !important;
      background: #cfcfcf;
    }
    

    5. Save & Publish. Refresh your browser and now you should be able to see your single-article runs without a sidebar and also the content section should now be wider.

    Let me know if this helps.

    Thread Starter shewenttospain

    (@shewenttospain)

    Thanks for the replies!! So the #main and #secondary code in the second comment didn’t work.

    The full-stretch idea didn’t work either, but it’s interesting. It looks like it is 100% width of its relative content area. So the content is spread out 100% but the area itself needs to be wider. For example, my background is white but when you changed the color to cfcfcf, the content fills the gray space perfectly. It’s just the gray space that needs to be wider. Can I make the width over 100%? 150%?

    Thread Starter shewenttospain

    (@shewenttospain)

    Actually I figured it out!

    This one does work when I don’t use the standard single post instead of the template I created:
    #main {
    width:100%;
    }
    #secondary {
    display: none;
    }

    Thanks everyone for all the help!

    AddWeb Solution

    (@addweb-solution-pvt-ltd)

    @shewenttospain, Good to see that our provided solution worked for you. Can you please mark as “Accepted Solution” to make my put in efforts worth

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Making a single post full width (no sidebar)’ is closed to new replies.