Recently I achieved a personal goal of writing a Book Collection Star Rating Plugin for WordPress, submitting it to WordPress and having it approved! The plugin can now be downloaded from the WordPress repository.
This plugin is a piece of a much larger personal book collection WordPress project that I am currently working on as time allows. I am building an online collection of all the books I have read since the early 90’s, which is when I started keeping track of this data. Check this generatepress vs astra article that aims to help you understand those differences so you can make an informed decision.
I am hoping to eventually release the entire project. It’s in working form but I need to clean up the code and continue testing. I looked at a number of themes and plugins to use for a book collection but none did quite what I wanted so I decided to create something for myself. I am planning to write more about this process soon but for now I will discuss the book collection star rating plugin.
The Book Collection Star Rating Plugin
In my project, I wanted to include a star rating of between 1-5 stars for each book, which is intendeed to be my own rating and not something that visitors to the site could vote on or add themselves. I located one plugin that would work internally, for visitors, or both but did not work with custom post types, which is what I needed for my project. Since it also had more features than I needed, I decided to make my own rather than change the code to work with custom post types.
The plugin uses the WordPress wp_star_rating function to display the numerical rating as stars. There isn’t too much information about that function so it took me a little trial and error to get it working properly. Since that function already exists in the core WordPress files, I didn’t need to recreate it and was able to include it in the plugin.
What the Book Collection Star Rating Plugin Does
- After installing and activating the plugin, there will be new custom field or the post, page, or custom post type screen called Rating.
- Half stars can also be used so the rating can be between .5 and 5 stars. Add your rating to the Rating field.
- The plugin uses the shortcode [star] so add that to the post or page.
- Since I can never remember the different shortcodes used by installed plugins, I also made a button for the visual and text editors that you can use to add the shortcode to your post or page with a simple click. Text EditorVisual Editor
- After adding the shortcode to your post or page, the rating will look like this
Of course, I wouldn’t be using this to rate a blog post like this – it is intended for collections and personal reviews.
This isn’t a plugin that there is a huge demand for but was something simple I needed so I decided to make it available and get it listed in the WordPress plugin repository.
If you would like more information or would like assistance setting up your own collection or review site, please contact me.