wp-postratings
wp-postratings copied to clipboard
Custom vote text (singular and plural)
Hi Lester! First of all, thanks for the plugin. I know it's a bit dated, but still works great. :+1:
Recently I needed a feature that was mentioned on #21, so I thought about opening this PR.
With this changes, you can set custom vote texts for singular words as well as plural words on the Options Page (it defaults to 'vote/votes'). It implements a new token (%RATINGS_VOTE_TEXT%) so that it can be replaced with the correct value, given the number of ratings.
I've also replaced all the custom default templates that had the word 'votes' with the new token.
Hmm if a user upgrades to the next version, it will break. Because there is no default value for the custom vote text singular or plural. I am suggesting wrapping
$ratings_vote_text_singular = get_option('postratings_vote_text_singular');
$ratings_vote_text_plural = get_option('postratings_vote_text_plural');
To a function that returns 'votes' or 'vote' if the get_option value is empty.
I will also see if there are any more people who need this feature before I merge =) Don't want to bloat it.
All right, no problem!
I'll wrap the calls to the get_option functions and send you a fix, so you can eventually merge if there's more people interested. Thanks!
So, it looks like the get_option function accepts a second parameter that is returned as a default value in case the option doesn't exist. Is that correct? (First time working with WP).
Hi @bmonteirog and @lesterchan I would love to have this function. When you think you can merge it?