2

I'm trying to find out if there's a way to output alternative markup for the {stars_overall_avg} and the {stars}{rating}{/stars} rating tags.

Instead of the images, I'd like it to output a set of tags I can hang classes from.

Cheers Brendan

2

It's possible to ignore the built-in {stars} and {starts_overall_avg} tags and just output the numbers using the {rating} and {overall_avg} tags instead.

This allows you to do some clever things such as add variable class names to elements depending on the rating. Your CSS can then use these class names to alter the display of the data. For example:

<p class="star-{rating} rating">{rating}</p>

You can now use the CSS class to affect how the number is displayed by showing images other than stars and hiding the rating number using CSS text replacement techniques if desired.

2
  • Thanks Steve, although this time I've resorted to using a different theme for the stars, this looks like it could be a great option in the future. Oct 9 '13 at 0:49
  • The great thing about this solution is it allows you to add all the possible ratings into a single CSS sprite image.
    – Alex Roper
    Oct 20 '13 at 5:48
1

You would probably have to hack mod.rating.php to make that happen. search for stars_avg_rating I don't think this would be a small undertaking.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.