Viewing 15 replies - 1 through 15 (of 18 total)
  • same questions here

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

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

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

    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.

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

    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.

    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, https://codex.www.ads-software.com/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. ??

    Thread Starter dporchia

    (@dporchia)

    @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?

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

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

    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(); ?>

    Great! It is working good. Thanks chacha2000.

    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?

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

Viewing 15 replies - 1 through 15 (of 18 total)
  • The topic ‘[Plugin: WP Favorite Posts] Display amount of favorites for individual posts’ is closed to new replies.