Edit Custom Post Type Icon

Supplemental 65 views
0
0 Flares 0 Flares ×

As an example we have used the “restaurant” Custom Post Type and icon, change line 9 thru 11 to suit your post type and icon.

<?php
/* Change Edit Posttype Icon in backend
 * source: http://wpsnipp.com/index.php/functions-php/change-custom-post-type-icon-for-new-and-edit-post-pages/
 */
function so_post_type_icon() {
	global $post_type;	
	?>
	<style>
		<?php if ( $post_type == 'restaurant' ) { ?>
			.icon32-posts-restaurant {
                background: url( "<?php echo get_stylesheet_directory_uri() . '/images/ico_restaurant.png';?>" ) no-repeat center center transparent !important;
                }
		<?php } ?>
	</style>
<?php }
add_action( 'admin_head', 'so_post_type_icon' );
add_action( 'admin_head-post.php', 'so_post_type_icon' );
add_action( 'admin_head-post-new.php', 'so_post_type_icon' );

What Will This Change?

Below is a screenshot showing what type of icon this snippet can change:
Custom Post Type Icon

For Reference:

Change Custom Post Type Icon

Provided by: Piet Bos
Tagged with: , , ,
Posted in Wordpress

Discuss:

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

No Trackbacks.

Login

Register | Lost your password?
0 Flares Twitter 0 Facebook 0 Google+ 0 0 Flares ×