Here you can find the Sterne plugin for download. I tried it successfully on WordPress 1.5 and 2.0 RC3.
[Update V1.1]: Improved coloring. Now colors should appear brighter and not too grey.
Bugs: Grey stars cannot currently be created.
Now it is possible to have an arbitrary number of rating stars in any color. (For an example, see this post).
- gd with png support (should be available with most web hosters) and
- Sterne subdirectory in the plugins directory must be writable (created colored stars are cached in this directory).
- same as Version 0.1
- Stern(points,totalpoints,red,green,blue). points must be less than totalpoints, which should be an even number. red, green andblue denotes the color which is used to ‘tint’ an grey source picture. For simplicity I use full color saturation so you might need to experiment a little.
Stern(5,8,50,250,250) will look like this:
Note: the source images can be exchanged! So if you’re not satisfied with the stars, e.g. you want to make them bigger feel free and replace those files. Source images must be transparent, indexed gifs. Colorless is preferable (but not required) to get consistent results. Color change does not work with grey colors.
If you want stars somewhere else than just in the postings, you will have to add additional hooks at the end of the script. For example, to have stars in the title of your postings, add the following pair of lines to the end of the file:
Installation: extract files to the plugin directory. If the stars don’t show up, the problem is usually the image path. You can adjust the local variable
$Sterne_imagepath = "wp-content/plugins/Sterne/"; within the function Star() to match your local settings. On WordPress 1.5 I had to use an absolute path.
Usage: S t e r n(4,g) (without the blanks between the letters) within the text of your post to give you two filled gold stars and three empty stars: . Points are from 0-10. 0 = 5 empty stars, 10 = 5 filled stars. Colors available: s = silver/grey, r = red, g = gold, b = blue. Feel free to add more colors! Take a look at the script to see how to do it: You need to create three new image files (easy way is to simply adjust the HUE value within an image editor) and assign each an ending letter, then add appropriate code in the Star() function to map the letter to the files. Load the images to the “Sterne” subdirectory and you’re all set.
Note: If the stars don’t show up on the archive pages, use an absolute path.