Support » Plugin: NextGEN Gallery Voting » [Plugin: NextGEN Gallery Voting] Change Like / Dislike to Like only ;)

  • Resolved Wookiee


    Hey Guys. I have listed the changes i have made to the NextGen Voting plugin, in order to use the Like / Dislike option, but to REMOVE the Dislike part of it, ending up with only a LIKE option.

    I have also changed my word Like, to the word Vote instead, but i did not list those changes in here, but that is really really super easy.

    Q: Why did i want to change this?
    A: I am developing a website, where none of the other options worked for me. I simply needed the like / dislike option to be changed to like only.

    It is important to give credit to the original developer/s of this awesome plugin, don’t ever take things for granted. I am NOT an expert in php, simply a jack of all trades with a tiny bit of PHP knowledge.

    Version of WordPress: 3.3.2
    Version of NextGen Voting Pluging: V1.10.1
    Files to change:
    – nextgen-gallery-voting\ngg-voting.php
    – nextgen-gallery-voting\js\gallery_options.js

    Please note!! Copy your original 2 files somewhere as a backup. I have listed the line numbers of the ORIGINAL file! So after you have made your changes, the line numbers WILL vary! Do search and replace and ignore white space to get the correct code. I can NOT help you with this! Be smart lol

    File to change: nextgen-gallery-voting\ngg-voting.php

    23 changes (if i did this correctly)

    [ 288 lines of code moderated. For more than 10 lines of code please use instead. Honestly, use instead and consider using diff. ]

    Thats it!! Hope it helps someone.

    I just want to ask if anyone reads this far, does anyone know how to add confirmation to this option. Im looking for a popup that asks the user, Are you very very very sure you want to vote (like) that image? Because once you vote (or like), you cant change your mind.

    Basically just an ajax confirmation popup or something. Thanks guys have fun and good luck!

Viewing 15 replies - 1 through 15 (of 18 total)
  • Hey man, you code is down ¿Can you paste it again? please use pastebin in order to avoid the moderation. thanks

    Crap lol sorry bout that. Hope it helps

    any sample preview?

    Need help. Not only did your code NOT work, it wiped out all current votes. Changed everything exactly how you instructed.

    It’s impossible for the code changes to wipe your current votes. The code changes has nothing to do with the current votes already stored in the database.

    The output is changed however, so it will “not show” any dislikes that has already been “voted”, but the votes are still in your database. This simply removes the button (dislikes) and leaves you with only 1 button to click.


    I will list the changes again, but I have made extra changes which I will explain in detail:

    1) nextgen-gallery-voting\ngg-voting.php

    a Removed all traces of dislike
    b Changed the word Like to Vote
    c Added css classes
    – This is to have a hover state for the button (in css)
    – The css code is added in point no 3 below


    2) nextgen-gallery-voting\js\gallery_options.js

    a Removed the output for dislikes


    3) The CSS
    You will need to add these CSS styles to your stylesheet:

    a Added div class=”like_button” around the Vote button
    – You can set the width as you want
    – You can set the background colors to what you wish
    – You can even use images as backgrounds if you wish
    – I have used nasty colours in the code below, but its to show you what colours goes where.

    NOTE: there is no button text as that is removed in ngg-voting.php, this is because I have used background images with the word Vote on my button images. So using the css below, will only result in blank but working buttons. To enter words in your buttons instead of having background images, read point 4 below.

    .like_button a:link, .like_button a:visited
    	border: 0px solid #33FF00;
    .like_button a:hover, .like_button a:active
    	border: 0px solid #FF6633;

    d Added span class=”like-results-text” around the word Vote/Votes
    – Because I want the results (amount of votes) to look different from the word Vote or Votes


    4) Adding text to button.

    To have ANY word appear on the buttons instead of going out to create background images with the word on the images itself

    In file ngg-voting.php (TWO changes)

    $out .= '<div class="like_button"><a href="'.$url.'gid='.$gid.'&r=1" class="nggv-link-like">&nbsp;</a></div>';

    Change to:
    $out .= '<div class="like_button"><a href="'.$url.'gid='.$gid.'&r=1" class="nggv-link-like">MY TEXT</a></div>';

    $out .= '<div class="like_button"><a href="'.$url.'ngg-pid='.$pid.'&r=1" class="nggv-link-like">&nbsp;</a></div>';

    Change to:
    $out .= '<div class="like_button"><a href="'.$url.'ngg-pid='.$pid.'&r=1" class="nggv-link-like">MY TEXT</a></div>';

    That should be it. Let me know how it goes. I have NOT tested the output (the look & feel) of voting for a gallery, ONLY voting for images.

    I’m not 100% sure, but Shauno (the original developer of this plugin) Should have the Like only option available in a next release. so up to you if you think this is too much work, but it works perfectly for me.

    Important update:

    There is an issue with the javascript file above in step 2.
    2) nextgen-gallery-voting\js\gallery_options.js

    I have made a mistake, I’m sorry >.<

    Whats wrong?
    – Gallery Voting options disappeared when you view/manage a gallery

    Either make the fix manually like this:

    Line 123
    Change this:
    html += '<td>'+(nggv_votes_list[i][0] == 100 ? 'Like' : 'Dislike d>';

    To This:
    html += '<td>'+(nggv_votes_list[i][0] == 100 ? 'Like' : 'Dislike')+'</td>';

    Copy the whole code over from here:
    Complete file:

    Hi, thanks for this nice Hack! The only thing, which doesn’t work, are the styles for the buttons below the gallerypic. I updated the star_rating.css , which is the only original .css in these plugin files with your codes mentioned above. It seems that the div class=”like_button” and the span class=”like-results-text” couldn’t pull out the stylesheets somehow…

    Now its looking like this:

    Can you help me?

    Regards Rico

    Hey Rico

    I’m doing this off my mind at the moment, so hopefully it will work.

    You should put the style code in the nextgen plugin stylesheet, not the voting stylesheet.

    Yours should go here:


    OR HERE but try the first mentioned above first

    /wp-content/themes/mydog/style.css (this is your template stylesheet)

    Hope it works.

    Hi Wookie, thx a million! Now it works. Was my mistake. You made may day! 🙂

    No worries..glad it worked

    Always remember, you can see which stylesheets are loaded in any page by just viewing the source. Right click > view source in your browser, then just search and find “.css”

    That way you can be sure on any given page which stylesheets are being loaded.

    If something doesnt work once you have made changes to your stylesheet, just check if the stylesheet is actually loaded.

    I only put the source code in the gallery stylesheet because if I ever decide to uninstall the plugin, i dont sit with unwanted code in my MAIN template code… if that makes sense, but any stylesheet that is loaded in ur page would make it work.

    Thx for your advice!

    Why not just add

    .nggv-link-dislike {
    display: none;}

    to a child style sheet?

    would you be able to help me and take me step-by step where to change the disklie? Thank you…
    Sorry to bother you… just very bad with wordpress….

    Do you update your theme often? (If so I would recommend setting up a child theme:

    Otherwise in the WP Dashboard go to Appearance > Editor. On the right it should say that your are in the style.css

    Scroll to the bottom of the text in the box and add:
    .nggv-link-dislike {
    display: none;}

    This should do it for you.

    rjsiebert :

    Adding The Following block of code removes the Dislike button.

    .nggv-link-dislike {
    display: none;}

    Once the user clicks on the Like button, It shows a summary below the image
    ‘1 Like 0 Dislikes’, Please can you advise how I can edit this message.

Viewing 15 replies - 1 through 15 (of 18 total)
  • The topic ‘[Plugin: NextGEN Gallery Voting] Change Like / Dislike to Like only ;)’ is closed to new replies.