WordPress
WordPress copied to clipboard
Add functionality for 3rd-party icons
This came up in #15, where bbPress and BuddyPress want to use icons in their projects. Part of converting to this SVG process was to enable other projects using WordPress greater flexibility: you're not restricted to Dashicons, and you don't need to create an entire font just to use your icons. You can create a small SVG sprite with just your icons, and call on them in your plugin/theme.
Currently we don't have the setup for this, so we should think about how to approach it.
My first idea is to have a "registration", like CSS and JS, where you can add an SVG sprite to a list, give it a name, and then in the wp_icon
function, you would specify which sprite to pull from.
So to use bbPress as an example*, the core plugin could register their own sprite, with just the logo, hive, honey, and bee:
add_svg_sprite( 'bbpress', $url_to_sprite )
Then after we've updated wp_icon
, would insert the hive icon like so:
wp_icon( 'hive', 'bbpress' )
We would also need to update the code in add_menu_page
to accept the sprite name too, but I think we need to update that either way for 3rd party plugins.
This is just one suggestion, I'm happy to keep brainstorming in this issue if anyone has other ideas.
I'm not picking on bbPress, it just has names I can use that aren't confusing placeholders 😄