Change custom post type icon for new and edit post pages

Adding this snippet to the functions.php of your wordpress theme will change the default icon on the post edit and new post pages. Don’t forget to change the URL on line 9 to the location of your 24px by 24px icon.

 

 

add_action( 'admin_head-post.php', 'post_type_icon');
add_action( 'admin_head-post-new.php', 'post_type_icon');
function post_type_icon() {
global $post_type;
?>
<style>
<?php if($post_type == 'products'){ ?>
#icon-edit {
background: url('<?php echo 'http://site.com/wp-content/themes/theme_name/i/icon_24x24.png';?>') no-repeat; }
<?php } ?>
</style>
<?php
}

Be Sociable, Share!

Leave a comment