According to the Codex admin_notice
does the following:
Notices displayed near the top of admin pages. The hook function
should echo a message to be displayed.
That means you cannot place them at the bottom or middle of your screen, if you use the hook. Furthermore if you place a div with the class notice anywhere in your admin pages, WP admin JS scripts will put them just where all the other notices would be; and they will behave like notices too.
FYI: I tested this already with a fresh install. ;)
But
If you want to show a admin_notice
at a particular page, you can add the action within a current_screen
action:
function my_admin_notice() { ?>
<div class="notice notice-info is-dismissible">
<p><?php _e( 'some message', 'my_textdomain' ); ?></p>
</div>
<?php
}
function my_current_screen_example( $current_screen ) {
// All your conditions go here, e.g. show notice @ post (not page) edit/new
if ( 'post' == $current_screen->post_type && 'post' == $current_screen->base ) {
add_action( 'admin_notices', 'my_admin_notice' );
}
}
add_action( 'current_screen', 'my_current_screen_example' );
More Information:
if ( /* some condition */ )
leads to confusions!