A nice touch when building a theme or plugin options page is to add your own icon next to the heading on the options page.
Here’s the correct way to do it:
First pass a string with the name of your plugin to the screen_icon() function, like so:
screen_icon( ‘my-plugin’ );
Then in your plugin’s CSS file, add something like so:
background: transparent url( ‘plugin-icon.png’ ) no-repeat;
This is preferable to adding the image directly into the HTML on the plugin options page. Only the approach of a
with a background image gives you the possibility to use a CSS sprite for the image, which is a great benefit, and which is something core and some plugins do.
If you enjoyed this post, make sure to subscribe to WPMayor’s RSS feed.