Hi there,
1) You could create yourself a shortcode and put the plugin’s function inside it:
http://codex.ww.wp.xz.cn/Shortcode_API
Not sure if it’s gonna work, it’s a nice experiment 🙂
2) You can use an image but I’m not sure you can do the dynamic change of colors. Perhaps it’s posible with jQuery.
Regarding the image buttons, check out this other thread: http://ww.wp.xz.cn/support/topic/vote-up-replace-text-with-images
Let me know if this helps,
Rick
Hi, and thanks for your answer!
I will try out the Shortcode_API if I manage to get the functionality as I want it! Thanks for the link 🙂
I’ve managed to change the icon of vote up & down to + and -, grejt link!
Although i ran in to problems directly…
I’m trying to make the values in floats/decimals. I’ve managed to make each vote only count 0.2 instead of 1 and the default value to be 38.0 BUT when i cast a vote and it becomas 38.3 and I reload the page it rounds it of to 38 and not showing the decimals…?
Is there a way to change int to float as default on the new counting …?
Hi again!
I managed to fix the design and also the degree rating system, the only thing I still have problems with is how to change the background of the span if the value gets over 40 degrees…
Is jQuery possible to use out of box in this plugin or do I need to install that library …?
Sure, jQuery comes with WordPress and the plugin uses it to function properly:
https://plugins.trac.ww.wp.xz.cn/browser/thumbs-rating/trunk/js/general.js
Check out this jQuery function, I think this is what you’re looking for:
http://api.jquery.com/contains-selector/
Hi again and thanks for your help + patient with me!
I’ve got the layout working, I got the plugin working with a short code but it’s these darn changing of the bg image in the span haha…
I really thought I had it working but this just makes the page go all grey except the header…
if ( $temperature >= 40.0 ){
jQuery(‘.temperature’).css(“background-image”, “url(hot-temp.png)”);
}elseif( $temperature <= 35){
jQuery(‘.temperature’).css(“background-image”, “url(cold-temp.png)”);
} else {
jQuery(‘.temperature’).css(“background-image”, “url(neutral-temp.png)”);
}
I looked at the link you sent me but it’s quite hard to use that version i think for me… it would be better with the css changer that is available in the jQuery… Do you have any idea of the code above..?
Alright, I know see that the jQuery function won’t work here.
We need to retrieve the value and parse it as float before you can add your IF statements.
Something like:
var temperature = parseFloat(jQuery('.thumbs-rating-up').text());
Change the .thumbs-rating-up selector to fit your code, this is just an example.
More on the parseFloat function: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/parseFloat
Rick
Thanks a lot for your help and kindness!
I’ll try converting the temperature later today.
Last night I tried to add a extra box with “++” that would add 0.4 instead of 0.2/-0.2 but I can’t get the program to update the value…
I can click the button and if I click again it says that i’ve already voted but the value is the same as before…
Are there more places than:
/* Add the thumbs up/down links to the content */
// Get the POST values
// Retrieve the meta value from the DB
I need to add the new “button” settings to…?
No I don’t think so. I think the values get stored as a string so you’ll need to convertem to float in two places:
1) When you send them to the database
2) When you get them from the database
Hope this helps.
Rick
Thanks Ricard!
Yeah, you were right. That was exactly the thing that had to be done. It’s all set now but when i’m trying to use parseFloat in the plugin the whole page becomes gray… like it’s not supported or something in the jQuery…
I’ll have to dig in to it, but thanks for all the help. I’ve managed to get two customized widgets out of your amazing work! Thanks again!
You’re welcome!
Would you mind leaving a review?
http://ww.wp.xz.cn/support/view/plugin-reviews/thumbs-rating
Thank you,
Rick
Sure, I’ve left a review!
i’ve managed to create the code for the coloring of the rating total BUT it loads on page load but disappears when a vote is submitted :S
Where should i place the code to make it run thru on pageload + when a vote is submitted and the new value is calculated…?
Hi there,
If you check the JavaScript file from the plugin (general.js) it might be the place to do it, after the Ajax call.