Full Width Home Image & Full Width Sections/

One simple way you can use to achieve full width sections on non-sidebar pages is to remove the “.container” and “.wrap” classes from the “.wrap” div and its child. Then do something like this immediately after:

<?php if(roots_display_sidebar()) : ?>
    <div class="container">
        <div class="row">
<?php endif; ?>

Then you need to close those divs immediately after the sidebar, inside the sidebar conditional.

So the final product would be like this:

<div class="wrap" role="document">
		<div class="content">
			<?php if(roots_display_sidebar()) : ?>
			<div class="container">
				<div class="row">
			<?php endif; ?>
					<main class="main <?php echo roots_main_class(); ?>" role="main">
						<?php include roots_template_path(); ?>
					</main><!-- /.main -->
					<?php if (roots_display_sidebar()) : ?>
					<aside class="sidebar <?php echo roots_sidebar_class(); ?>" role="complementary">
						<?php include roots_sidebar_path(); ?>
					</aside><!-- /.sidebar -->
				</div><!-- /.row -->
			</div><!-- /.container -->
					<?php endif; ?>
		</div><!-- /.content -->
	</div><!-- /.wrap -->

Hope that helps someone, as it took me a while to figure out how to do this without repeating myself.

5 Likes