Template issue on modified Three Column Layout

Featured Theme Forums General Discussion Template issue on modified Three Column Layout

This topic contains 4 replies, has 2 voices, and was last updated by  javapop 2 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #18203

    javapop
    Participant

    Hi Zeaks, I have been a NomNom user for several years on my rec dept site: http://wbcrd.com
    But just realized I had an issue with the menu not being fully responsive. I tried your tutorial on three columns, and voila, I now have a fully responsive theme for mobile devices with a right and left sidebar!

    I had a question, how tricky would it be to have a template that had just one sidebar? (On a site that used the above method)

    I would mainly use the 2 sidebars on main pages; but it would be good to have some other options.

    I did modify the page template and created a page-right.php template that only calls the right sidebar.

    I have noticed however that only my front page is showing the right and left sidebar. All others are listed as using default template; but showing right sidebar only.

    If you click on the about page, or any of the other pages, the left sidebar seems to be down towards the bottom right rather than showing up on the left side as it does on the front page.

    Which template would the default template be, and why would my 2 sidebars only be showing on the front page properly? I have tried isolating it using firebug; but can’t seem to figure this out.

    #18204

    javapop
    Participant

    Adding one more tidbit. It works fine on pages that have posts, so I am thinking that the sidebars show up properly when the content is long enough (does that make sense?)

    So, I need to somehow make sure that the page has an automatic minimum depth (or length?)

    Can anyone suggest something?

    #18205

    zeaks
    Keymaster

    Hi Javapop. I took a look at your site and it looks like the pages that the sidebar is not displaying properly are missing the .custom-layout body class. If you use chrome and “inspect” on one of those pages and add custom-layout to the body class list you’ll notice it posititions the sidebar properly.

    It’s been a long time since I’ve worked with this theme but in the tutorial I did add an update to include all page templates minus the special homepage template Twenty Twelve comes with.

    Check to make sure you’ve added that update and not the original, it should look like this.(it has an extra conditional than the original)

    // Add child theme body class
    function mytheme_body_class( $classes ) {
    		  
    	 if( !is_page_template( 'page-templates/front-page.php') && !is_page_template( 'page-templates/full-width.php' ) )
              $classes[] = 'custom-layout';
    		  
    	return $classes;
    }
    add_filter( 'body_class', 'mytheme_body_class' );

    As for your question about having one sidebar on a particular page. You could add a conditional to the above body class statement so the custom-layout class is not included for that particular page, then use display: none; along with a custom CSS class (page id or whatever to target that page only) to hide the sidebar on that page.

    There might be a cleaner way to do it but I’d have to refresh my memory with that theme.

    #18207

    javapop
    Participant

    I think I just used a clean version of twenty twelve. Can you let me know where I will find the updated version? The link you have for blank templates is no longer working.

    I am using a Mac, and for some reason, Chrome allows me to install firebug lite; but it won’t open. I do have firebug for Firefox and safari.

    #18208

    javapop
    Participant

    Okay, I just checked the functions.pho and yep, it had the earlier version body class:

    // Add child theme body class
    function mytheme_body_class( $classes ) {
    		  
    	 if( ! is_page_template() )
              $classes[] = 'custom-layout';
    		  
    	return $classes;
    }
    add_filter( 'body_class', 'mytheme_body_class' );
    

    So I updated it to the newer code, and checked a few pages and they appear load correctly now.

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.