Add information above a custom post type listing of all posts page

Ok, that sounds like a rather confusing title, let me explain.

I have created a custom post type (CPT) and I want to add some summary information about the posts of that post type above their listing (where the filter and bulk action buttons are), the page in question would be:

Read More
http://www.example.com/wp-admin/edit.php?post_type={cpt}

Is there a hook for this ? Since I don’t really know what to call this area, i am not finding anything doing any further searches.

Related posts

1 comment

  1. You can use the admin_notices action for that:

    function wpa_admin_notice() {
        $screen = get_current_screen();
        if( 'your_post_type' == $screen->post_type
            && 'edit' == $screen->base ){
            ?>
            <div class="updated">
                <p>Here is some text</p>
            </div>
            <?php
        }
    }
    add_action( 'admin_notices', 'wpa_admin_notice' );
    

    Change your_post_type to whatever your custom post type slug is.
    Also see get_current_screen for more info on that function.

Comments are closed.