Add Meta box Befoure Post Title

i would like to add an image above the post title… in the old days i would change that directly in wordpress code but thats not very affective.. you know, upgrades and such.

is ther a way using add_meta_box or some othere way to add a box directly above the post title?

Read More

tried this
Priority of Meta Box for Custom Post Type

BUt that didnt work.. help Please 🙂

Related posts

Leave a Reply

2 comments

  1. The only real chance you got is to hook into admin_notices, which is above the post-new.php page title & icon:

    function  wpse27700_above_title_content()
    {
        ?>
        <style>
        /* 
        You might need to attach some styles here,
        to not get into the admin notices styles 
        */
        </style>
    
        <h1>TEST</h1>
        <p>This is a test message</p>
        <?php
    }
    
    // This is needed to only hook on the post new & edit screens.
    function wpse27700_admin_head()
    {
        add_action( 'admin_notices', 'wpse27700_above_title_content', 9999 );
    }
    add_action( 'admin_head-post-new.php', 'wpse27700_admin_head' );
    add_action( 'admin_head-post.php', 'wpse27700_admin_head' );
    
  2. My answer is assuming you mean in the admin area on the post editing screen.

    Unfortunately there are no hooks to add things above the title.

    I did track down a (very hacky?) way to do this, however, by looking at the code for Premise (a landing page plugin by Copyblogger Media).

    Hook into something like dbx_post_sidebar, which is below all the post editing stuff and metaboxes. Echo out your image with a style attribute containing display:none;

    <?php
    add_action( 'dbx_post_sidebar', 'wpse27700_add_image' );
    function wpse27700_add_image() 
    {
        echo '<img id="wpse27700-image" src="http://placebear.com/500/100" alt="wpse27700 bear" style="display:none;" />';
    }
    

    Then using jQuery you can remove the image and place it above the title. I just hooked into admin_head to do this, but you can also enqueue a separate js file or whatever.

    <?php
    add_action( 'admin_head', 'wpse27700_admin_head' );
    function wpse27700_admin_head()
    {
        ?>
        <script type="text/javascript">
            jQuery(document).ready(function(){
                var wpse27700 = jQuery('#wpse27700-image');
                wpse27700.remove();
                jQuery('#titlediv #titlewrap').before(wpse27700.show());
            });
        </script>
        <?php   
    }
    

    Not the most direct solution, but it works. As a plugin: https://gist.github.com/1193612