Skip to content

Instantly share code, notes, and snippets.

@chrisguitarguy
Created September 4, 2011 22:13
Show Gist options
  • Save chrisguitarguy/1193612 to your computer and use it in GitHub Desktop.
Save chrisguitarguy/1193612 to your computer and use it in GitHub Desktop.
Adds an image above the title on the WordPress post editing screen.
<?php
/*
Plugin Name: Image Above Title
Plugin URI: http://pmg.co
Description: Adds an image above the title on the WordPress post editing screen.
Version: n/a
Author: Christopher Davis
Author URI: http://pmg.co/people/chris
License: creative commons/GPL2
*/
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;" />';
}
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
}
@Otto42
Copy link

Otto42 commented Dec 23, 2011

+1 for placebear

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment