WordPress.org

Ready to get started?Download WordPress

Forums

Reaction Buttons
[resolved] Display reaction count (13 posts)

  1. luispma
    Member
    Posted 3 years ago #

    Loving this plugin - it's exactly what I have been looking for. I run a music blog and this is by far the easiest and best way to get readers' reaction of songs/albums without waiting for a few people to comment.

    That's kind of why I am posting on this forum. I want to be able to display "reaction count" on the post meta data section on the index and single pages. Instead of a "comment count", I want there to be a "Reaction" count (i.e. "xx Reactions"). I hope it won't be too difficult because I know the plugin keeps track of the number of clicks/reaction each post receives because of this stats page: http://i54.tinypic.com/219v3p0.png

    Basically, I want the number in the parenthesis (pictured) on the post meta data section. Is this possible?

  2. Jakob Lenfers
    Member
    Plugin Author

    Posted 3 years ago #

    I'll release a version later this day with this feature. I'm just working on integrating some features I got a few weeks ago.

  3. Jakob Lenfers
    Member
    Plugin Author

    Posted 3 years ago #

    It's in v1.1. reaction_buttons_click_count($post_id) returns the number of all clicks for the post with the $post_id.

  4. luispma
    Member
    Posted 3 years ago #

    Wow, thank you very much! I'm not particularly good at even the simplest php editing. I added this to my theme:

    <span class="head"><?php _e('Reactions') ?></span>
                        			<span class="body"><?php reaction_buttons_click_count($post_id); ?></span>

    And the reaction click count is not showing up. What am i doing wrong?

  5. Jakob Lenfers
    Member
    Plugin Author

    Posted 3 years ago #

    Oh well, sorry, the function takes the post id as parameter. e.g.
    reaction_buttons_click_count(33);
    But usually you want it dynamic in your theme. While you are "in the loop" (you usually are while dealing with posts in the standard themes), the following will most likely work for you:
    <span class="body"><?php echo reaction_buttons_click_count(get_the_ID()); ?></span>

  6. luispma
    Member
    Posted 3 years ago #

    Thank you! That works perfectly.

  7. mdevaney
    Member
    Posted 3 years ago #

    wondering if there is a simple way to not display the vote count and just display "voted counted" instead.

  8. mdevaney
    Member
    Posted 3 years ago #

    oh and use an image as the button?

  9. Jakob Lenfers
    Member
    Plugin Author

    Posted 3 years ago #

    No, there is no way to not show the reactions after someone clicked. You can use CSS to use an image as the buttons.

  10. mdevaney
    Member
    Posted 3 years ago #

    well i got rid of the number [Vote(1)], and votes are being counted. the only other thing is i would need to make it popup and say "vote counted" like it does when you have already voted.

  11. mdevaney
    Member
    Posted 3 years ago #

    for example AFTER the vote, show vote text like:

    $html .= " voted' href=\"javascript:alert('".htmlspecialchars('Already Voted')."');\">";

  12. mdevaney
    Member
    Posted 3 years ago #

    or an after vote, redirect to custom link

  13. Jakob Lenfers
    Member
    Plugin Author

    Posted 3 years ago #

    There is no way atm to do that. You can add your own java script if you want to, you seem to have found the places. :)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic