I am trying to move the WP Admin bar on the front end to below my themes main header navigation, as well as make it the same width.
I am using the GeneratePress theme and am getting support from them to achieve this, however we’re stuck.
Here’s what they said,
“ I just dug through the core WordPress code for the admin bar hoping to find a way to unhook the current position and move it somewhere else, but I came up empty.
Basically, we need to unhook the bar from the current position and hook it into a different action.”
Any ideas on how to achieve this?
1 Answer
The admin bar is hooked to wp_footer
. So …
remove_action( 'wp_footer', 'wp_admin_bar_render', 0 );
… will remove it from there. And then you can register it for a custom hook with:
add_action( 'my_custom_hook', 'wp_admin_bar_render', 1000 );
You still have to overwrite the CSS in your stylesheet, but that should be fairly simple.
Oh, and welcome to WordPress Stack Exchange! 🙂