• Resolved squasher

    (@squasher)


    Hi,

    I’m using this (great!) plugin in my website with the following code:

    <?=function_exists('thumbs_rating_show_up_votes') ? thumbs_rating_show_up_votes() : ''?>

    Is it possible to show the button without the +&number of votes (so only Vote up for instance)?

    Thanks!

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

    (@quicoto)

    I’m afraid there not an easy thing to do. No config or way to do it easily in CSS.

    I would recommend forking the plugin (or modifying the files directly).

    The function you should look for is thumbs_rating_getlink you could edit it to not print the number.

    You will need a bit of PHP knowledge though.

    Thread Starter squasher

    (@squasher)

    Hi Ricard,

    Thank you for your reply. I edited the file. Neatly coded!

    Thanks.

    Plugin Author Ricard Torres

    (@quicoto)

    Awesome, glad it worked out.

    Hello @squasher ,

    Can you kindly assist with your solution?
    I’m try to achieve the same results but I’m finding it
    very difficult overriding the “thumbs_rating_getlink” function
    from my child’s theme function.php

    Any other help plus that of @squasher in solving this problem is highly appreciated

    Thanks in advance

    Plugin Author Ricard Torres

    (@quicoto)

    @mogeh I guess @squasher ended up modifying the plugin directly. You can also do that. Perhaps bumping the plugin version yourself to 99 to prevent from your changes being potentially gone should we push an update to the plugin.

    Hello @quicoto ,

    Thanks for your prompt response always and
    blessing us with this great plugin.

    back then when the vote up and vote down button were wrapped with a span tag as
    seen below:
    <span class="thumbs-rating-up thumbs-rating-voted" onclick="thumbs_rating_vote(78, 1);" data-text="Vote Up +">2</span>
    it was easy to hide. But after updating recently, i found out that the HTML structure has changed and i have been struggling with hiding the text again.

    I wish to make some request:

    1. Can you kindly wrap the buttons text in a span tag so that it can be easily hidden with CSS, like below:
    <button class="thumbs-rating-up thumbs-rating-voted" onclick="thumbs_rating_vote(389, 1);"><span>Vote Up +</span>1</button>
    And release an update.

    I can easily modify the plugin files directly and bump up the version number as suggested; But what if a critical update is released for the plugin? It means i will miss it and other relevant subsequent updates.

    2. kindly provide help with overriding the “thumbs_rating_getlink” function.

    Though not good with PHP, i did some research and learnt that

    if  ( ! function_exists( 'thumbs_rating_getlink' ) ):
    
        function thumbs_rating_getlink($post_ID = '', $type_of_vote = '', $wrapper = true)
        {
    
        }
    
    endif;

    is a pluggable and that i could override it by doing the following:

        function thumbs_rating_getlink($post_ID = '', $type_of_vote = '', $wrapper = true)
        {
    
        }

    I have tried it and other ways of overriding a function but i keep getting errors.

    The fault could be from my side because of my deficiency in PHP, i will highly appreciate your help.

    Thanks @quicoto in advance.

    Plugin Author Ricard Torres

    (@quicoto)

    Thank you for your kind words ??

    1. Why can’t you hide the button with CSS, I don’t get why you need the span.

    You can select anything with a class selector:

    .thumbs-rating-up { display: none; }

    2. Yeah maybe I’m missing something but I thought it was possible. That’s why I added the function checks. It has been quite some years since I’ve done PHP development myself.

    There shouldn’t be any critical updates now that we’ve taken out the jQuery dependency, unless the WordPress core changes dramatically how it handles the meta data (highly doubtful as they always aim for backwards compatibility).

    If all this is too much and it was already working for you in your production site, why not revert back to a version of the plugin prior to 4?

    I’m sorry if this isn’t what you wanted to hear.

    Thanks @quicoto for your time so far.

    If i used .thumbs-rating-up { display: none; }, it hides the button but
    what i want to achieve is to hide the text before the votes counts; that was why i was requesting for the wrapping of the text in a span so that it can be easily hidden with CSS.

    I will look for a permanent solution to it with time.

    Thanks and my best regards.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Show button without number of votes’ is closed to new replies.