WordPress.org

Ready to get started?Download WordPress

Forums

WP Favorite Posts
Display amount of favorites for individual posts (19 posts)

  1. dporchia
    Member
    Posted 2 years ago #

    Looks like my question wasn't approved eariler so I'll try again.

    Is there a template tag that will display the amount favorites an individual post has?

    My goal is to display (for each post) the amount of favorites it has received.

    Thanks for your time and this great plugin!

    http://wordpress.org/extend/plugins/wp-favorite-posts/

  2. lzhao
    Member
    Posted 2 years ago #

    same questions here

  3. alvaro05
    Member
    Posted 2 years ago #

    Me too. This shows up on the widget but not on individual posts or list of favorite posts.

  4. taifurbau
    Member
    Posted 2 years ago #

    I'm facing same problem. I need a solution in badly. Please do something asap.

  5. enderpal444
    Member
    Posted 2 years ago #

    fifted! Would be great to show on posts how many times they've been favorited.

  6. hello World
    Member
    Posted 2 years ago #

    That's exactly what I want!

    It would be great to show the number of favorites of each post by using a template tag.

    I found the best favorite posts widget has that function to show the number of favorietes.

  7. enderpal444
    Member
    Posted 2 years ago #

    Duh all of us. It's stored as a custom meta field for the post. Solved

  8. taifurbau
    Member
    Posted 2 years ago #

    dear enderpal444, I'm new in wordpress. plz tell me how can I display that custom field value in post byline. I use thesis theme. Thanks in advance.

  9. hello World
    Member
    Posted 2 years ago #

    Thanks enderpal444!

    @taifurbau
    There is a custom meta field in each post.
    In order to use that data, you need to know how to use the custom meta data.
    Please check this, http://codex.wordpress.org/Custom_Fields.

    Here is my sample code to display the number of favorites of each post.

    <?php
    	 $key="wpfp_favorites";
    	 $favorite_count_check = get_post_meta($post->ID, $key, true);
    
    	echo $favorite_count_check." people like this post.";
    ?>

    You can put the code somewhere you want to display. :)

  10. dporchia
    Member
    Posted 2 years ago #

    @HwangC

    I tried to implement your sample code into my site but the total favorites for the post doesn't show up. All I see is the "people like this post." text.

    <span class="mixtapeStats">
    											<b class="tapeViews">											<?php echo getPostViews(get_the_ID()); ?> <span class="statTxt">Views</span>
    </b>
    											<b class="tapeComments">												<?php comments_number('0', '1', '%'); ?> <span class="statTxt">Comments</span>
    </b>
    											<b class="tapeFavs">												<?php
    	 $key="wpfp_favorites";
    	 $favorite_count_check = get_post_meta($post->ID, $key, true);
    
    	echo $favorite_count_check." people like this post.";
    ?>									</b>										</span>

    As you see, I have the total Views and Comments, but cannot get the total favorites to display correctly.

    Any suggestions?

  11. enderpal444
    Member
    Posted 2 years ago #

    @dporchia Clean up your reply. We don't need any code but what is used for the favorite count.

  12. taifurbau
    Member
    Posted 2 years ago #

    I've the same issue what dporchia said. there is no value displaying by the codes.

  13. chacha2000
    Member
    Posted 2 years ago #

    Hi everyone, try adding this to your functions.php file :

    function wpfp_get_current_count() {
        global $wpdb;
    	$current_post = get_the_ID();
        $query = "SELECT post_id, meta_value, post_status FROM $wpdb->postmeta";
        $query .= " LEFT JOIN $wpdb->posts ON post_id=$wpdb->posts.ID";
        $query .= " WHERE post_status='publish' AND meta_key='wpfp_favorites' AND post_id = '".$current_post."'";
        $results = $wpdb->get_results($query);
        if ($results) {
            foreach ($results as $o):
                echo $o->meta_value;
            endforeach;
        }else {echo( '0' );}
    }

    And then just use this in your template files to display the number of "favorites" the current post has received <?php wpfp_get_current_count(); ?>

  14. taifurbau
    Member
    Posted 2 years ago #

    Great! It is working good. Thanks chacha2000.

  15. jeremyarey
    Member
    Posted 2 years ago #

    Is there a way to just display the total amount of favorites a user has? On my site, I have a favorites icon and I want to show the number of favorites a user has next to that icon. Is this possible?

  16. schwooba
    Member
    Posted 1 year ago #

    I would like to see this feature (what jeremyarey said)too. Thanks for the great plugin.

  17. MnLGmz
    Member
    Posted 1 year ago #

    Hello,

    I would like to know how can i do to Add the counter and next Add a PNG Image without text 'Add or Remove from Favs'

    I would like to make modifications to see my theme like this one:

    http://themeforest.net/item/i-love-it-content-sharing-wordpress-theme/full_screen_preview/698475

    Would be possible add the same effect?

    http://wordpress.org/extend/plugins/wp-favorite-posts/

  18. taifurbau
    Member
    Posted 1 year ago #

    How to show total No. of favorites for a post automatically just like "Facebook Like counter" i.e. when a user make favorite a post then automatically increase the no. of total favorites of that post by users.
    Thanks in advance.

  19. MnLGmz
    Member
    Posted 1 year ago #

    I think this plugin can help you better:

    http://wordpress.org/extend/plugins/kk-i-like-it/installation/

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic