Check the following function in V4.0.0:
???? /**
* Get most liked posts in query
*
* @param integer $numberposts
* @param string $post_type
* @param string $method
* @param string $period
* @param string $status
* @return WP_Post[]|int[] Array of post objects or post IDs.
*/
function wp_ulike_get_most_liked_posts( $numberposts = 10, $post_type = '', $method = '', $period = 'all', $status = 'like' ){
$post__in = wp_ulike_get_popular_items_ids(array(
'type' => $method,
'status' => $status,
'period' => $period
));
if( empty( $post__in ) ){
return false;
}
return get_posts( apply_filters( 'wp_ulike_get_top_posts_query', array(
'post__in' => $post__in,
'numberposts' => $numberposts,
'orderby' => 'post__in',
'post_type' => $post_type === '' ? get_post_types_by_support( array(
'title',
'editor',
'thumbnail'
) ) : $post_type
) ) );
}
-
This reply was modified 4 years, 11 months ago by Alimir.