Site logo

[Resolved] Star Rating System

Home Forums Support [Resolved] Star Rating System

Home Forums Support Star Rating System

  • This topic has 43 replies, 4 voices, and was last updated 3 years ago by Bernardas.
Viewing 15 posts - 1 through 15 (of 44 total)
  • Author
    Posts
  • #2035681
    russel

    hi, I’m aware that it is outside of your scope but I can’t seem to find any documentation regarding this feature.

    I want to add a star rating system only by using shortcodes/alt code etc. – similar to this :
    https://www.nintendolife.com/reviews/nintendo-switch/beyond-a-steel-sky

    Is it possible to create this without resorting to plugins?

    #2035693
    David
    Staff
    Customer Support

    Hi there,

    you can check out my Gist here that creates a shortcode for displaying x out of 5 stars:

    https://gist.github.com/diggeddy/ef3dc0315a73c0caad839c5348b89aa6

    #2035704
    russel

    Thanks!

    I guess I’ll just have to edit this to make it x out of 10:

    ‘stars’ =>5

    Am i right?

    #2035707
    David
    Staff
    Customer Support

    That just sets the default value – you can change it to 10.
    But to get it to display 10 stars means changing these two lines:

    $percentage = 100 * $value['stars'] / 5;
    $html = '<span class="star-bar">★★★★★</span>

    to:

    $percentage = 100 * $value['stars'] / 10;
    $html = '<span class="star-bar">★★★★★★★★★★</span>

    Copy and paste the star unicodes – there should be 10 of them, as they will render in this forum

    #2035711
    russel

    thankyou

    While I’m here, could you direct me to documentation on how to implement this shortcode?

    sorry, totally newbie here

    #2035753
    russel

    Ignore my last reply, Just implemented it!

    however, I change the “stars” to “apples” and it seems the function is broken.

    It always shows 10 apples. no matter what value I insert

    this is the “apple” html code: 🍎

    #2035764
    russel

    HTML-code

    &#127822 ;

    Space included so it doesn’t show the image

    #2035768
    David
    Staff
    Customer Support

    Looks like the unicode is being coverted to an emoji. Which will not work with that shortcode.
    You will need to make sure its stays unicode. You can try adding this CSS to force that:

    .star-bar {
        font-family: monospace;
    }
    #2035918
    russel

    Hmm.. i think it doesn’t work

    #2035934
    David
    Staff
    Customer Support

    Did it work with the stars ?

    #2035943
    russel

    the stars works just fine, can’t seem to force the apple emoji to stay unicode

    #2036033
    David
    Staff
    Customer Support

    Can you share a link to the page where i can see the apples?

    #2036049
    russel

    Private link provided

    #2036091
    David
    Staff
    Customer Support

    Well thats a pain in the ***
    The Apple logo symbol works just fine:

    = & #63743; without the space

    Will that do ?

    #2036131
    russel

    Rendered as ? on my end.

    I’ll just have to give up with the apples and stick with the stars instead 🙂

    Is it possible to resize the star to fit on the body container similar to nintendolife article I provided earlier.

Viewing 15 posts - 1 through 15 (of 44 total)
  • You must be logged in to reply to this topic.