Can I add descriptive text to the voting graphic?

Can I add descriptive text to the voting graphic?

I would like to add a few words ("Let us know if you like this post" for example) to the voting graphics.


  • Alexander
    • DEV MAN’s Mascot

    Hey there @molyvos,

    There are a few ways of doing this. First you turn off the automatic controls, and use the provided shortcodes

    Second, you could add a filter to "the_content" this would require a bit of coding knowledge, but if you're interested, I could elaborate and give you enough information to get started.

    You could actually combine both methods as well. You could use the do_shortcode within the filter and have complete control over how this gets shown on the page. If you're interested in doing this, let me know.

    Just let me know what else I can help you with here!

  • Robin
    • Design Lord, Child of Thor

    Hi there Alexander,

    Thanks for the quick reply. adding a shortcode to each post is not exactly the answer I was looking for. It could get tedious if the site gets busy.

    Option 2 - coding. Did you say coding? Now my blood pressure is up again. At the risk of a nervous breakdown perhaps you could "get me started", but you will need to keep it simple.

  • Alexander
    • DEV MAN’s Mascot

    No problem!

    For the most part this is quick enough I could just get the code together for you. Then you can put it in your theme's functions.php

    Ok, so we have a few options. Go to "Settings -> Post Voting" to see what shortcodes are available.

    We could do something like:

    Let us know if you like this post [wdpv_vote]

    That would just do your message, followed by all the post voting elements. Or we could mix it up and do something like this:

    [wdpv_vote_result] Let us know if you like this post [wdpv_vote_up] [wdpv_vote_down]

    This would show the number first, then the message, then the up/down controls.

    Just let me know what order you'd like and the exact message and I'll get the function for you.

    Best regards

  • Alexander
    • DEV MAN’s Mascot

    Hi @molyvos,

    I just tried this, and I'm sorry it's not quite like I expected. I ran into some formatting issues and I think this would just be easier if we modified the plugin directly.

    To do this, first open up the file /lib/class_wdpv_codec.php from the post voting plugin folder.

    Go to line 182 and you will see this:

    $ret = do_shortcode("<div class='wdpv_voting'>{$ret}</div>");

    Next, copy the following to your clipboard:
    <p style='float: left;margin-right: 20px; margin-top: 10px; '>Let us know if you like this post</p>

    Place your cursor right after the first closing bracket like this:
    $ret = do_shortcode("<div class='wdpv_voting'>[cursor]{$ret}</div>");

    Paste the code from above. It will look like this:
    $ret = do_shortcode("<div class='wdpv_voting'><p style='float: left;margin-right: 20px; margin-top: 10px; '>Let us know if you like this post</p>{$ret}</div>");

    Now save the file. We've essentially just hardcoded the message into the plugin. I've tested this, and confirm it works well. Let me know how it goes for you, and if you need help with any steps.

    Thanks for being a WPMU DEV member. Let us know if we can be of any further assistance.
    Best regards,

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.