WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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. http://i.imgur.com/QKHkEqs.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!

share|improve this question
up vote 0 down vote accepted

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

share|improve this answer
Hey Wyck! Thanks for the help(again). I was looking up option 2, and found a great tutorial on this: wpengineer.com/2426/wp_list_table-a-step-by-step-guide One thing that I am confused about is how to pull post type data into the new custom WP_List_Table. I believe I am pulling the post type correctly, but I'm not sure how to display the Title, Excerpt, etc. Attached below is a link for what I currently am working with. pastebin.com/57AdDbDv – Roc Mar 8 '13 at 3:13
You should ask this is a separate question on here. – Wyck Mar 8 '13 at 3:26
Alright thanks. Well sure enough, I even found a better example: mac-blog.org.ua/wordpress-custom-database-table-example-full Thank you again for the great help. I feel comfortable marking this as answered since you gave me the direction into where to look. – Roc Mar 8 '13 at 3:39
There is another example here which is very well documented: plugins.trac.wordpress.org/browser/custom-list-table-example/… – Wyck Mar 8 '13 at 3:41

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');
share|improve this answer
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 '13 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 '13 at 16:05

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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