salcode / bootstrap-genesis

WordPress Genesis Child Theme setup to use Bootstrap, Sass, and Grunt
MIT License
184 stars 63 forks source link

Change sidebar-content code order? #78

Closed dustyndoyle closed 9 years ago

dustyndoyle commented 9 years ago

Currently the sidebar-content layout has the same code order as the content-sidebar layout.

<main class="content col-sm-9 col-sm-push-3">
</main>
<aside class="sidebar col-sm-3 col-pull-9">
</aside>

The only difference between the layouts is the sidebar-content has the push and pull classes to flip the order. For a project I am working on I needed the sidebar markup to be first, so on mobile screens the sidebar shows up before the content. With the current way it is working it would not do that because the content markup is first and the sidebar markup is second, making the content display first on mobile screens. The biggest problem with moving the sidebar is the genesis_do_sidebar function does not remove the <aside> tags, only the inner content. Today after lots of searching I found the genesis_get_sidebar function. With this function you can do something like this to move the whole sidebar before the content

if( 'sidebar-content' === genesis_site_layout() ) {
       remove_action( 'genesis_after_content', 'genesis_get_sidebar' );
       add_action( 'genesis_before_content', 'genesis_get_sidebar' );
}

I'm not sure if you want to move this way or not, but I thought I would bring it up as a possibility instead of floating the sidebar left. I also checked the genesis theme and they are doing the same thing as you with floating the sidebar left and content right. The main problem I have with doing it this way is I expect the sidebar to come first on the mobile view in the sidebar-content layout, but it does not because of the floats being used.

salcode commented 9 years ago

@dustyndoyle This is an interesting question. I chose to use the push and pull classes because my instinct is that on mobile the content is the most important thing and should come first.

Sidebars are generally the same across pages and on a mobile device I want to get to the unique content as quickly as possible. I think having the unique content come first is also be beneficial from an SEO perspective.

I can certainly imagine situations where the sidebar (whether it be left or right) would need to come before the content on mobile view but I think this is an edge case. Thank you for posting your solution as I'm sure I'll hit this edge case at some point and knowing the solution already is awesome.

Overall, I am going to mark this wontfix and close this issue.

Thanks.