• Hi!

    I really enjoy your plugin Thumbs rating! Although I now want to customize it to fit my needs…

    1. Is it possible to use a shortcode for the voting box + result? This is key feature for me because that’s how I want to use it and add it to a lot of pages but not all of them and there is really no good way to sort among them other than by human eye…

    2. Is it possible to use a + image for the vote up and – for the vote down and a box that uses +/- degrees for example.

    -40° or the default value 37° …? And if the value goes under 25 the result box becomes blue and if it goes over 45 it becomes red/orange…?

    https://www.ads-software.com/plugins/thumbs-rating/

Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Author Ricard Torres

    (@quicoto)

    Hi there,

    1) You could create yourself a shortcode and put the plugin’s function inside it:

    https://codex.www.ads-software.com/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: https://www.ads-software.com/support/topic/vote-up-replace-text-with-images

    Let me know if this helps,

    Rick

    Thread Starter tobbie94

    (@tobbie94)

    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 …?

    Thread Starter tobbie94

    (@tobbie94)

    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 …?

    Plugin Author Ricard Torres

    (@quicoto)

    Sure, jQuery comes with WordPress and the plugin uses it to function properly:

    https://plugins.trac.www.ads-software.com/browser/thumbs-rating/trunk/js/general.js

    Check out this jQuery function, I think this is what you’re looking for:

    https://api.jquery.com/contains-selector/

    Thread Starter tobbie94

    (@tobbie94)

    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..?

    Plugin Author Ricard Torres

    (@quicoto)

    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

    Thread Starter tobbie94

    (@tobbie94)

    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…?

    Plugin Author Ricard Torres

    (@quicoto)

    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

    Thread Starter tobbie94

    (@tobbie94)

    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!

    Plugin Author Ricard Torres

    (@quicoto)

    You’re welcome!

    Would you mind leaving a review?

    https://www.ads-software.com/support/view/plugin-reviews/thumbs-rating

    Thank you,

    Rick

    Thread Starter tobbie94

    (@tobbie94)

    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…?

    Plugin Author Ricard Torres

    (@quicoto)

    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.

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Shortcode customize vote count’ is closed to new replies.