What I am trying to accomplish is placing custom widget on an admin page (edit.php). I tried using these two functions:

Places custom html right below < body > (above all page content)

add_action( 'load-edit.php', 'your_function' );
function your_function() {
    include( plugin_dir_path( __FILE__ ) . 'quickpost/quickpost.php');

Places custom html below the < footer >

add_action('admin_footer', 'post_add_quickpost');
function post_add_quickpost() {
    include( plugin_dir_path( __FILE__ ) . 'quickpost/quickpost.php');

Here is were I am trying to place the widget, just above the posts table on the edit.php page. https://i.stack.imgur.com/ZL1uY.jpg

Is there a way I can specify where to place the code? I would prefer to work with the 'load-edit.php' action, but if that is not possible - it is okay with me. Thanks!

2 Answers 2


As far as I know you have 2 options.

  1. Using admin_footer or load-edit.php and position with absolute or fixed, or use JavaScript.

  2. If you creating a completely new posts screen (not a default posts, pages, etc), you can extend WP_List_Table class, specifically the extra_tablenav function.

For example:

class My_Custom_Table extends WP_List_Table {

    function extra_tablenav( $which ) {

        if ( $which == "top" ){
            //The code that goes before the table is here
            echo "Hello, I'm before the table";
        if ( $which == "bottom" ){
            //The code that goes after the table is there
            echo "Hi, I'm after the table";

As far as I can tell, extending this class can only work on a custom admin page, and not the current existing ones, as there are no hooks available. You can read more about it here: http://codex.wordpress.org/Class_Reference/WP_List_Table


I think that add_action( 'load-edit.php', 'your_function' ); is the correct way to do it, since it's the only admin action designed to be fired only on a specific page. I would just style my metabox so that it's absolutely positioned at the bottom of the posts list.

You could also look at some other available actions available during an admin page load. If you find one that's more appropriate, you could use a basic page check to load your plugin on only the desired page, something like:

add_action( 'some-admin-action', 'your_function' );
function your_function() {
     global $pagenow;
     if (is_admin() && $pagenow=='edit.php')
           include( plugin_dir_path( __FILE__ ) . 'quickpost/quickpost.php');
  • Hi bcorkins, Thanks for the input. Hmm, do you think positioning it absolute is the only way I can display the widget where I need it to be loaded? I'm trying to think of what the negative drawbacks will be when being displayed across multiple browsers/screens. Thanks!
    – Roc
    Mar 6, 2013 at 15:57
  • I think that's the best way. What I would do, if it were my plugin, and depending on your comfort with js/jquery, would be to create the box as a modal, draggable, closable box, maybe to the right of the post list. That way a user could move it around if it was in the way. But that may be overkill. These days absolute positioning is pretty consistent across all major browsers. You could test it in browser using the web dev tools and see how it looks.
    – bcorkins
    Mar 6, 2013 at 16:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.