[wp-trac] [WordPress Trac] #26922: WP-Admin - Allow for Additional Icon Fonts

WordPress Trac noreply at wordpress.org
Fri Jan 24 19:28:01 UTC 2014


#26922: WP-Admin - Allow for Additional Icon Fonts
----------------------------+------------------------------
 Reporter:  styledev        |       Owner:
     Type:  enhancement     |      Status:  new
 Priority:  normal          |   Milestone:  Awaiting Review
Component:  Administration  |     Version:  3.8
 Severity:  normal          |  Resolution:
 Keywords:                  |     Focuses:  ui
----------------------------+------------------------------

Comment (by melchoyce):

 At some point Till Kruess wrote up a guide for using an alternate icon
 font:
 https://github.com/tillkruess/MP6-Icon-Examples/blob/master/mp6-font-
 icon.php

 I was able to tweak it enough to work in a CPT. I think this was what I
 ended up with inside my CPT class:


 {{{
 function __construct() {
         add_action( 'admin_enqueue_scripts', array( $this,
 'enqueue_[CPT]_styles'  ) );
         add_action( 'admin_head', array( $this, 'set_custom_font_icon' )
 );
 }

 function enqueue_[CPT]_styles() {
         wp_enqueue_style( '[CPT]-font',  plugins_url(
 'css/[CPT]-font.css', __FILE__ ), array(), $this->version );
 }

 /**
  * Custom CPT Icon CSS
  */
 function set_custom_font_icon() {
 ?>
     <style type="text/css">
         #menu-posts-[CPT]_menu_item .wp-menu-image:before {
             font-family: '[CPT]-font' !important;
             content: '\e603' !important;
         }
     </style>
 <?php
 }
 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/26922#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list