Question

I'm changing the backend/admin and want to show a div above the pages. How can I include the pages like the example;

example

<?php
include('./tools.php') ;

this works but when I choose edit.php / edit.php?post_type=page it doesn't show anything.

Was it helpful?

Solution

First...

I'm changing the backend/admin ...

Your description makes it sound like you are hacking Core. Don't do that. It is a maintenance nightmare.

The action hook in_admin_header looks to be placed about where you want to put your content.

190 /**
191  * Fires at the beginning of the content section in an admin page.
192  *
193  * @since 3.0.0
194  */
195 do_action( 'in_admin_header' );

Use that hook to add your content.

function admin_content_wpse_144936() {
  echo 'howdy';
}
add_action('in_admin_header','admin_content_wpse_144936');

If you look at the 75 lines or so below that hook in the source you will see several other hooks that might be promising as well.

The admin_head-$hook_suffix hook could be used to give you pretty good control over when your content is added. For example:

function admin_content_wpse_144936() {
  echo 'howdy';
}

function add_admin_content_wpse_144936() {
  add_action('in_admin_header','admin_content_wpse_144936');
}
add_action('admin_head-edit.php','add_admin_content_wpse_144936');
Licensed under: CC-BY-SA with attribution
Not affiliated with wordpress.stackexchange
scroll top