How to add some custom HTML to the edit posts page

As found here:

http://codex.wordpress.org/Function_Reference/add_meta_box

/**
 * Calls the class on the post edit screen
 */
function call_someClass() 
{
    return new someClass();
}
if ( is_admin() )
    add_action( 'load-post.php', 'call_someClass' );

/** 
 * The Class
 */
class someClass
{
    const LANG = 'some_textdomain';

    public function __construct()
    {
        add_action( 'add_meta_boxes', array( &$this, 'add_some_meta_box' ) );
    }

    /**
     * Adds the meta box container
     */
    public function add_some_meta_box()
    {
        add_meta_box( 
             'some_meta_box_name'
            ,__( 'Some Meta Box Headline', self::LANG )
            ,array( &$this, 'render_meta_box_content' )
            ,'post' 
            ,'advanced'
            ,'high'
        );
    }


    /**
     * Render Meta Box content
     */
    public function render_meta_box_content() 
    {
        ?>
        <div class="mydiv">
          <img src="https://wordpress.stackexchange.com/questions/47384/someImage.png" alt="someImage"/>
          <script type="text/javascript">alert('hello world!');</script>
        </div>
        <?php

    }
}

Leave a Comment