WordPress.org

Support

Support » Plugins and Hacks » Hacks » [Resolved] Change Default "Posts" Admin Icon

[Resolved] Change Default "Posts" Admin Icon

  • I’ve been trying for the life of me to figure out how to change the default “thumbtack” icon of the “Posts” menu on the backend to something else. Unfortunately, when searching Google for this, all I get is how to do it with Custom Post Types—not the default/existing “post” post-type. I know with a Custom Post Type you use ‘menu_icon’ in your args when registering the Custom Post Type, but I can’t figure out how to do it with ‘post’. I assume it’s something like changing the labels, so I tried this:

    function change_post_icon() {
    			global $wp_post_types;
    			$args = &$wp_post_types['post'];
    			$args->menu_icon = get_stylesheet_directory_uri() . '/images/newsletters-icon.png';
    	}

    However, that didn’t work. Any ideas? I’m of course editing my functions.php file.

    Thanks for any assistance!

Viewing 1 replies (of 1 total)
  • *Sigh* I feel dumb. I should have just done this with good ole CSS. For future Googler’s,

    Enqueue a CSS document in your functions.php file as so:

    if (is_admin()) {
    		wp_enqueue_style('my_meta_css', get_template_directory_uri().'/css/meta.css');
    	}

    Then in said meta.css document, change it as so:

    .icon16.icon-post, #adminmenu .menu-icon-post div.wp-menu-image {
    	background: transparent url('../images/menu.png') no-repeat scroll -151px -33px !important;
    }
    
    #adminmenu .menu-icon-post:hover div.wp-menu-image, #adminmenu .menu-icon-post.wp-has-current-submenu div.wp-menu-image {
    	background: transparent url('../images/menu.png') no-repeat scroll -151px -1px !important;
    }

    First one for the normal state, second for the hover.

Viewing 1 replies (of 1 total)
  • The topic ‘[Resolved] Change Default "Posts" Admin Icon’ is closed to new replies.
Skip to toolbar