WordPress Snippets at WPcustoms

Add HTML before and after admin list post table

This function modifies the admin post edit screen. It adds html to the top above the post edit table and above the footer where it says “Thank you for creating with WordPress.”
Customize the get_current_screen and choose the pages where the custom html should be displayed.


/**
 * Snippet Name: Add HTML before and after admin list post table
 * Snippet URL: https://wpcustoms.net/snippets/add-html-before-and-after-admin-list-post-table/
 */
  add_action( 'load-edit.php', function(){
   $screen = get_current_screen();
    // Only edit post screen:
   if( 'edit-post' === $screen->id )
   {
        // Before:
        add_action( 'all_admin_notices', function(){
            echo '

Greetings from all_admin_notices!

'; }); // After: add_action( 'in_admin_footer', function(){ echo '

Goodbye from in_admin_footer!

'; }); } });