[wp-trac] [WordPress Trac] #26922: WP-Admin - Allow for Additional Icon Fonts
WordPress Trac
noreply at wordpress.org
Fri Jan 24 19:38:26 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 styledev):
Replying to [comment:4 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
> }
> }}}
Right, this is what is required to use your own icon font currently. While
I get that we can do this it would be nicer/easier if we could just
provide the ability to add the css classes that already come with the
font.css instead of having to write out the content call every time for
each menu item in a css file which is separate from the register_post_type
call. For the example image above you would be writing out 4 lines of css
times 11 for a total of 44 lines instead of just calling 'prefix-
iconName'. Also, by using the unicode/glyph content it is not intuitive as
to what icon is what when you are in there.
My thinking is we are already handling one icon font prefix for dashicons,
why not expand the code a little to handle any prefixes?
--
Ticket URL: <https://core.trac.wordpress.org/ticket/26922#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list