I found here on WPSE that you can add content before post title in the post page, and in custom post type pages

    add_action( 'load-edit.php', function(){

       $screen = get_current_screen();

        // Only edit post screen:
       if( 'edit-reservation' === $screen->id )
       {
            // Before:
            add_action( 'all_admin_notices', function(){
                echo '<p>Greetings from <strong>all_admin_notices</strong>!</p>';
            });

        }
    });

Which works in my reservation custom post type. But I’m wondering if it’s possible to output content after the title, but before table with custom post types?

enter image description here

2 s
2

You could try to “hijack” the following filter in the WP_List_Table class:

/**
 * Filter the list of available list table views.
 *
 * The dynamic portion of the hook name, `$this->screen->id`, refers
 * to the ID of the current screen, usually a string.
 *
 * @since 3.5.0
 *
 * @param array $views An array of available list table views.
 */
 $views = apply_filters( "views_{$this->screen->id}", $views );

Example

For the edit-post screen, the filter is views_edit-post:

/**
 * Display HTML after the 'Posts' title
 * where we target the 'edit-post' screen
 */
add_filter( 'views_edit-post', function( $views )
{
    echo '<p>Greetings from <strong>views_edit-post</strong></p>';

    return $views;
} );

and this will display as:

greetings

Leave a Reply

Your email address will not be published. Required fields are marked *