Roots Discourse

Best practices with full bleed for base.php / WP Theme structure

Often I have a theme that requires templates with full bleed featured images or full bleed widgets. That means much of the default base.php is useless, as I need to grab different header templates and the theme is easier to maintain if containers and the grid are specified exclusively in the template files. What DRY method should I be using?

Would it make sense to extend the Sage Wrapper class and make a conditional header function?

I figure this must be a common problem and someone ought have a smart solution…

Continuing the discussion from Roots Radio – Topics/Questions

Keep in mind that Sage is a starter theme, so feel free to hack up base.php as required.

This is also a Bootstrap question… but I think you have an understanding of the .container class. Basically, just edit your files as necessary.

If you will always have a page header that’s full-width but content that is not, then move the call to the page header template outside of page.php and put it in base.php and/or call it conditionally. If content is also always or potentially full-width, then you may have to swap .container for .container-fluid and proceed to wrap any content areas individually with .container on an as needed basis.

Just remember that keeping things DRY is a good practice and always good to be aware, but don’t sacrifice DRY too much for readability or common sense, especially where it relates to templates - sometimes a template is going to have duplicate classes and div’s. The theme wrapper does help to cut down on it by a large extent though.