Move sidebar above the entry content for specific page
Original request:
Is it possible to move the sidebar above the content for specific pages? For example, when the phone becomes mobile responsive, I would like for only a single page to show the sidebar before the page content. I am using the Enterprise Pro theme.
Any help would be appreciated. Thanks in advance.
Here is the snippet. You will add the code in your functions.php file
1 2 3 4 5 6 7 8 9 10 11 12 |
add_action( 'wp', 'gd_move_sidebar_before_content' ); function gd_move_sidebar_before_content() { if( ! is_page( 2 ) ) //* my page ID is 2. you will replace it with your page ID or slug return; //* Remove after content sidebar remove_action( 'genesis_after_content', 'genesis_get_sidebar' ); //* Add sidebar above the content add_action( 'genesis_before_content', 'genesis_get_sidebar' ); } |
Leave a Reply