8/2/2023 0 Comments Dash icon wordpressI'm answering myself because today I asked myself the 2 questions I posted, and spent some time to find an answer. ![]() Is possible to use dashicons css for WP 3.8+ and use custom image set up via 'menu_icon' param for previous versions in a "simpler" way that doesn't involve add 2 conditional for every CPT registered?Īnd, if so, is possible do that in some automagic way straight from register_post_type without any additional code? it seems to me more a workaround than an elegant solution.that involves to add some code (2 conditional statements) for every CPT registered, so updating plugins/themes is quite an hard work.I know I can conditionally add 'menu_icon' in register_post_type for WP 3.8- versions and conditionally add previous css for WP 3.8+, but: However using both 'menu_icon' argument of register_post_type and previous css will print both icons in WP 3.8 and one icon + a strange char in WP 3.8-, and without use 'menu_icon' argument, on older versions the default icon is used. That aside, I think that use the new dashicons for my CPT will be cool.Īfter some research, I know I can just use the CSS from dashicons, something like #menu-posts-mycpt div.wp-menu-image:before With the default dark menu background in WP 3.8 my icons become almost invisible. In my plugins/themes I often use that argument with my custom icon images that normally are dark because before 3.8 admin menu had a light background. Now, is well know that register_post_type has an argument 'menu_icon' that allow to specify a custom icon for the CPT admin menu entry. ![]() WordPress 3.8 introduced in core the plugin MP6 that among other things use an iconic font called Dashicons to display fonts in the dashboard.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |