While working on a plugin, I realized I had forgotten to put on my admin page template the
<div class="wrap"> tags, and the margins were off. So I quickly added that, and then started seeing things.
I was testing out actions that give out notices and error messages on my plugin, and I could sometimes literally see the error message jumping from the top part of the page, where I had put it, further down.
div element with class
And there it was:
// Move .updated and .error alert boxes. Don't move boxes designed to be inline. $('div.wrap h2:first').nextAll('div.updated, div.error').addClass('below-h2'); $('div.updated, div.error').not('.below-h2, .inline').insertAfter( $('div.wrap h2:first') );
This code in the common.js script moves
<div> elements that have the class
error, and that don’t have the class
inline, below the first
<h2> element inside the
Because I had just put in the wrapper
<div>, this rule suddenly started applying to my page! I had a
<h2> element down on my page, and the message boxes were now getting
insertAftered below it.
The solution is easy: Use
<h2> as your page header, not
<h1> as I had done. That’s how all the WordPress admin pages seem to have it. Logical? I don’t know.