Move Sidebar Above Content

When making a mobile responsive website, it is common to make the content and sidebar go full width and stack on mobile devices. If you have something important in your sidebar, like your site’s menu, this code will move the sidebar above the content area. When they go full width and stack, the sidebar will be on top.

<?php
/**
* Move Sidebar above Content
*
* @author Bill Erickson
* @link http://www.billerickson.net/code/move-sidebar-content/
*/
remove_action( 'genesis_after_content', 'genesis_get_sidebar' );
add_action( 'genesis_before_content', 'genesis_get_sidebar' );
view raw functions.php hosted with ❤ by GitHub

Bill Erickson

Bill Erickson is a freelance WordPress developer and a contributing developer to the Genesis framework. For the past 14 years he has worked with attorneys, publishers, corporations, and non-profits, building custom websites tailored to their needs and goals.

Ready to upgrade your website?

I build custom WordPress websites that look great and are easy to manage.

Let's Talk