Fetch likes count

I’m using Buddypress with rtmedia plugin. What I’m trying to achieve is to display total media likes count of each members’ gallery on their respective header. I tried this code but it always displays 0… Maybe someone can help

function custom_rtmedia_likes() {
global $rtmedia;
$likecount = intval( $rtmedia->likes ); ?>
<p>
<span id=”media-likes”><?php echo $likecount; ?> Likes</span>
</p>
<?php

}

add_action(‘bp_before_member_header_meta’, ‘custom_rtmedia_likes’);

Read more here:: Fetch likes count

Leave a Reply

Your email address will not be published. Required fields are marked *