Closed dennop closed 5 years ago
The "get_favorites_count" function returns the count, wrapped in a span tag with data attributes necessary for ajax functionality.
With what you're trying to do, you'll need to specify the html parameter as false (3rd param).
Try this:
<?php
$favorites_count = get_favorites_count($post_id = null, $site_id = null, false);
if ( intval($favorites_count) < 5 ){
// Show Something
} else {
// Show Something Else
}
Hi @kylephillips I wanted to display different message depending on the favorites count on single.php template,
Unfortunately, it didn't work. Please help me. Also, I tried to put back the _$postid, still it cannot check the condition successfully.