var content, post_title, excerpt, $notice,
postData = getSavedPostData(),
cookie = wpCookies.get( 'wp-saving-post' ),
- $newerAutosaveNotice = $( '#has-newer-autosave' ).parent( '.notice' );
+ $newerAutosaveNotice = $( '#has-newer-autosave' ).parent( '.notice' ),
+ $headerEnd = $( '.wp-header-end' );
if ( cookie === post_id + '-saved' ) {
wpCookies.remove( 'wp-saving-post' );
return;
}
+ /*
+ * If '.wp-header-end' is found, append the notices after it otherwise
+ * after the first h1 or h2 heading found within the main content.
+ */
+ if ( ! $headerEnd.length ) {
+ $headerEnd = $( '.wrap h1, .wrap h2' ).first();
+ }
+
$notice = $( '#local-storage-notice' )
- .insertAfter( $( '.wrap h1, .wrap h2' ).first() )
+ .insertAfter( $headerEnd )
.addClass( 'notice-warning' );
if ( $newerAutosaveNotice.length ) {