Twenty Thirteen: Load Genericons in a More Plugin-friendly Way
|Reported by:||celloexpressions||Owned by:||lancewillett|
|Component:||Bundled Theme||Keywords:||has-patch commit|
Genericons are a useful tool for plugins, but it is currently difficult to use them in a plugin in an efficient way. It would be nice if Twenty Thirteen loaded them in a way that would both play nicely with plugins that want to use them and set a standard for how plugins should load them.
I came up with a couple of options:
- Package Genericons directly with WordPress, instead of bundled through Twenty Thirteen, and register as a style in core (wp_register_style()), then wp_enqueue_style('genericons') in both Twenty Thirteen and plugins. Plugins could also package Genericons if targeting WordPress <3.6. The loaded stylesheet would just contain the @font-face declaration. But having Genericons available directly in core wouldn't be as appropriate as, for example, having Dashicons available (for front-end use) would be.
- Move the @font-face declaration to its own file and load it with wp_register/enqueue_style(). Plugins could check for Genericons with wp_style_is() and load them if necessary, which would decrease the potential to load from multiple places. This would establish a "correct" method for loading Genericons in plugins and at least provide the tools to avoid duplicate declarations, but could be messier to implement in plugins.
Both methods have advantages and disadvantages, and there are probably additional possibilities, but I think we should do something a bit more standardized than the current setup (loading Genericons from the main style.css file).
Change History (23)
- Keywords has-patch added
- Milestone changed from Awaiting Review to 3.6
- Version set to trunk
comment:12 @lancewillett — 2 years ago
- Owner set to lancewillett
- Resolution set to fixed
- Status changed from new to closed
comment:13 @DrewAPicture — 2 years ago
- Resolution fixed deleted
- Status changed from closed to reopened