Recently I was working on a ratings website, and needed a quick way to consistently generate the current star ratings of the items. Many of you are familiar with the ‘dashicons’ font that is shipped with WordPress, but if you aren’t, it’s a simple icon-font available to theme and plugin developers. You’re probably more familiar with it than you think, it’s used to add icons to the WordPress admin dashboard menu:

Screen Shot 2014-07-07 at 12.27.33 AM

There are 3 icons I was interested in, and they are the 3 stars:
Screen Shot 2014-07-07 at 12.41.41 AM

With those icons, I could generate something that looked like this:
Screen Shot 2014-07-07 at 12.34.11 AM

This function allows accuracy to the closest 1/2 star. You simply pass in your rating number, and it will return you HTML output for the stars.

As a note, if your theme doesn’t include dashicons in the front end (by default it’s only in the Admin), you can use the following to add it:

To get a full listing of items included in the Dashicons font, visit

Image courtesy of Scott Cresswell via Flickr

Post Promoter Pro

Posted by Chris Klosowski

Hi, I'm Chris Klosowski. Currently I am a Lead Developer of Easy Digital Downloads, where we build the easiest way to sell digital products with WordPress. I am also the person behind Post Promoter Pro, the most effective way to promote your WordPress Content.


  1. Fantastic. Saved me some time there! Many thanks.


    1. Awesome! Glad to hear that!


  2. Thanks so much! This is awesome!


  3. Exellent tutorial Chris. You just saved me hours of rolling out my own from scratch.


Leave a reply

Your email address will not be published. Required fields are marked *