This question already has an answer here:

I'm looking to have the home page main content section full width 100% and all other pages with sidebar at 75%.

I have a homepage template set up, what can I add to the homepage template (page-home.php) so that only that page displays 100% in the main content section

    <div id="container">
        <div id="content" role="main">

        /* Run the loop to output the page.
         * If you want to overload this in a child theme then include a file
         * called loop-page.php and that will be used instead.
        get_template_part( 'loop', 'page' );

        </div><!-- #content -->
    </div><!-- #container -->

The website is vistahomeimprovement.com

marked as duplicate by fuxia Jan 27 '17 at 19:05

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


As far as you are using home-page.php template only for main page, you can add class directly to container div and apply css rules to it:

<div id="container" class="on-main-page">...</div>

enter image description here


#container.on-main-page {
 float: none;
 width: 100%;
  • Did you look at the website? – Alexander Jan 27 '17 at 18:04
  • Yes, I did. Your content div has 75% width and floats right. If you add logic I've posted, you can then add css rule like this: #content.your-class-for-main-page { float: none; width: 100%; } – Артур Пипченко Jan 27 '17 at 18:25
  • If you could explain a bit further for me I apologize for my lack of knowledge on this subject. So do i add the logic you posted in the home page php template? Then add the ccs rule you posted into the main content section in the style.css? – Alexander Jan 27 '17 at 18:39
  • Excuse me, I've just figured out, that you have separate template file (page-home.php), which, I assume, is used only for your home page. So you can add class directly without any "if" logic, because this template is not used elsewhere (or is it?). – Артур Пипченко Jan 27 '17 at 18:48
  • Yes i have a page-home.php template just for the homepage not other pages. – Alexander Jan 27 '17 at 19:03

Not the answer you're looking for? Browse other questions tagged or ask your own question.