Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom vote text (singular and plural) #130

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

bmonteirog
Copy link

Hi Lester! First of all, thanks for the plugin. I know it's a bit dated, but still works great. 👍

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.

@lesterchan
Copy link
Owner

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.

@bmonteirog
Copy link
Author

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!

@bmonteirog
Copy link
Author

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).

@diegosantamarta
Copy link

Hi @bmonteirog and @lesterchan I would love to have this function. When you think you can merge it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants