I have two custom post types created (using Types
plugin) with a bunch of custom fields.
I need to add a help information, instructions for admins that will show at the top of add new/edit CPT page of dashboard.
How can I add a text visible only on those two pages (add/edit post type 1
and add/edit post type 2
)?
Try this:
function options_instructions_example() {
global $my_admin_page;
$screen = get_current_screen();
if ( is_admin() && ($screen->id == 'custom_post_type_name') ) {
function add_content_after_editor() {
global $post;
$id = $post->ID;
echo '<div class="postbox" style="background:#0074a2;color:#fff;margin-top:20px;"><div class="inside">';
echo 'Instructions go here.';
echo '</div></div>';
}
add_action( 'edit_form_after_title', 'add_content_after_editor' );
}
}
add_action( 'admin_notices', 'options_instructions_example' );
It will result in something that looks similar to this:
http://i.stack.imgur.com/5rU66.png