Skip to content

Snippet: Move Top Bar Outside The Header

Important: This is NO longer the case. The top bar is now hooked into wpex_hook_wrap_top with a priority of 5. So instead of adding this code to your site please update your theme!

/* The top bar is by default hooked into the header so when the header is disabled
 * so is the top bar. However, you can move the Top Bar into a different hook to prevent that
 *
 * @deprecated Please update your theme because this is now the default structure in the latest version
 * no need to add any code to your site.
 */
function my_move_top_bar() {

	// Remove from the header hook
    remove_action( 'wpex_hook_header_before', 'wpex_top_bar' );

    // Re-add with low priority to make sure it comes before the header
	add_action( 'wpex_hook_wrap_top', 'wpex_top_bar', 5 );

}
add_action( 'init', 'my_move_top_bar', 20 );
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)
Back To Top