• Resolved mmikolas

    (@mmikolas)


    Hello,

    do you think you could implement an option to set when there is a 0.0 and 5.0 in the rating to only show 0 or 5?

    It also occurs to me that it would be great to be able to display at 0,0 – i.e. if there is no rating – a text rating that there is no rating. We leave 0,0 displayed and this would be aesthetically great.

    The last thing I can think of is the overall verbal rating. Display with text rating or separate text ratings for a predefined range, e.g.: 0-1 (poor), 1-2.5 (average), etc.

    It’s already a great tool for us and I’m sorry you don’t have a donate button in the plugin. I can’t afford to buy premium, but if I can, I’ll support you!

    Thanks!

Viewing 1 replies (of 1 total)
  • Plugin Author Gemini Labs

    (@geminilabs)

    do you think you could implement an option to set when there is a 0.0 and 5.0 in the rating to only show 0 or 5?

    I’m assuming you mean the in the rating summary?

    Try this:

    add_filter('site-reviews/summary/value/rating', function (string $value): string {
    if ((float) $value === floor($value)) {
    return (int) $value;
    }
    return $value;
    });

    it would be great to be able to display at 0,0 – i.e. if there is no rating – a text rating that there is no rating. We leave 0,0 displayed and this would be aesthetically great.

    Try this:

    add_filter('site-reviews/summary/value/rating', function (string $value): string {
    if ((float) $value === 0.0) {
    return __('No ratings yet', 'your-theme-domain');
    }
    return $value;
    });

    Display with text rating or separate text ratings for a predefined range, e.g.: 0-1 (poor), 1-2.5 (average), etc.

    Try this:

    add_filter('site-reviews/summary/value/rating', function (string $value): string {
    $rating = (float) $value;
    if ($rating <= 1) {
    return __('Poor', 'your-theme-domain');
    }
    if ($rating <= 2.5) {
    return __('Okay', 'your-theme-domain');
    }
    if ($rating <= 3.5) {
    return __('Good', 'your-theme-domain');
    }
    return __('Excellent', 'your-theme-domain');
    });
Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.