Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm trying to load the admin toolbar on the front end immediately after the head tag in my header.

I'm trying to achieve something like this as opposed to how it usually gets loaded at the end of the page.

<header>
<div id="wpadminbar" class="show-wp-toolbar" role="navigation">...</div>
<nav>
<ul>
<li><a href="index.php">Home</a></li>
<li><a href="/about/">About</a></li>
<li><a href="/blog/">Blog</a></li>
</ul>
</nav>
</header>

I want the menu bar to flow naturally with the rest of the page instead of being fixed so when I scroll up it hides with everything else.

I've found the admin bar gets loaded in "wordpress/wp-settings.php" on line 146:

   require( ABSPATH . WPINC . '/admin-bar.php' );

And admin bar itself is at:

   wordpress/wp-includes/class-wp-admin-bar.php 
   wordpress/wp-includes/admin-bar.php

However, I'm new at PHP and have had trouble figuring out how the order of page elements is determined.

share|improve this question
add comment

1 Answer

This is just a CSS edit. You don't need to alter how or where the admin menu loads. Add ...

#wpadminbar {
  position: absolute;
}

to your theme's stylesheet.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.