views:

14

answers:

1

Does anyone know of a way to add an input field (or any type of html for the matter) directly above (or below) the title input field on the post edit page ?

I'm looking of a way to do this without modifying core files (I'm doing this as part of a plug-in which creates a custom post-type).

I'm not aware of any available wp hooks in that area of the edit-form-advanced.php file which could help out. I really hope some has come up with a genius workaround !

+1  A: 

You're on the right track; pursue the add_action('admin_head') point of entry. What you want can specifically be done with a bit of JavaScript + jQuery (which is built into WP). To display the input field above the title input field, do something like this:

add_action('admin_head', 'my_admin_head_in_posts');
function my_admin_head_in_posts() {
?>
jQuery('#post').before(
'<div id="id_my_field" class="updated below-h2">' +
'<input type="text" name="my_field" value="lol" />' + 
'</div>'
);
<?php
}

And you should be seeing something like this: alt text

pp19dd
Aha ! Yes, I hadn't imagined using Jquery to "hack" the order in which the html could be displayed. I'll give this a try and get back to you if it works out !
sctgraham