Snippet: Move Sidebar Above Content On Mobile
Important: This code is no longer required and will cause your sidebar to not display! You can now choose the sidebar placement in the Customizer.
The following code snippet will move the HTML for the Total theme sidebar so it's added before the content. This way, on mobile the sidebar will display at the top. In fact if you use this snippet your sidebar won't display at all in Total 6.0+. So if you've updated to Total 6.0 and your sidebar is missing, please make sure this code snippet hasn't been added to your site.
// Move sidebar before content so it displays at the top on mobile
add_action( 'init', function() {
remove_action( 'wpex_hook_primary_after', 'wpex_get_sidebar_template' );
add_action( 'wpex_hook_primary_before', 'wpex_get_sidebar_template' );
} );
All PHP snippets should be added via child theme's functions.php file or via a plugin.
We recommend Code Snippets (100% Free) or WPCode (sponsored)
We recommend Code Snippets (100% Free) or WPCode (sponsored)