- This topic has 43 replies, 4 voices, and was last updated 3 years ago by
Bernardas.
-
AuthorPosts
-
December 2, 2021 at 6:21 am #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-skyIs it possible to create this without resorting to plugins?
December 2, 2021 at 6:30 am #2035693David
StaffCustomer SupportHi 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
December 2, 2021 at 6:39 am #2035704russel
Thanks!
I guess I’ll just have to edit this to make it x out of 10:
‘stars’ =>5
Am i right?
December 2, 2021 at 6:41 am #2035707David
StaffCustomer SupportThat 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
December 2, 2021 at 6:44 am #2035711russel
thankyou
While I’m here, could you direct me to documentation on how to implement this shortcode?
sorry, totally newbie here
December 2, 2021 at 7:26 am #2035753russel
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: 🍎
December 2, 2021 at 7:36 am #2035764russel
HTML-code
🍎 ;
Space included so it doesn’t show the image
December 2, 2021 at 7:39 am #2035768David
StaffCustomer SupportLooks 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; }December 2, 2021 at 7:52 am #2035918russel
Hmm.. i think it doesn’t work
December 2, 2021 at 8:07 am #2035934David
StaffCustomer SupportDid it work with the stars ?
December 2, 2021 at 8:12 am #2035943russel
the stars works just fine, can’t seem to force the apple emoji to stay unicode
December 2, 2021 at 9:06 am #2036033David
StaffCustomer SupportCan you share a link to the page where i can see the apples?
December 2, 2021 at 9:14 am #2036049russel
Private link provided
December 2, 2021 at 9:40 am #2036091David
StaffCustomer SupportWell thats a pain in the ***
The Apple logo symbol works just fine:=& #63743;without the spaceWill that do ?
December 2, 2021 at 10:03 am #2036131russel
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.
-
AuthorPosts
- You must be logged in to reply to this topic.