• Hi. No doubt this is the best like/unlike plugin and I like it a lot. But I’m having trouble implementing the sort feature in my custom query and I’ll appreciate any help.

    This my default custom query:

    $heroes_query = new WP_Query(
    array(			
        'posts_per_page' => 3,
        'post_type' => 'heroes',
        'order' => 'DESC'
        )
    );

    And this is what I tried and no luck:

    $heroes_query = new WP_Query(
    			
        array(		
            $post__in = wp_ulike_get_popular_items_ids(array(
                'type'   => 'post',
                'status' => 'like',
                'period' => 'all'
            )),	
            'posts_per_page' => 3,				
            'post_type' => 'heroes',
            'post__in' => $post__in,
            'orderby' => 'post__in',
            'order' => 'DESC'
        )
    ); 
Viewing 1 replies (of 1 total)
  • I have the same problem. The correct value for my likes is shown in the admin tools and on my custom post pages. But sorting on most likes won’t work. For me wp_ulike_get_popular_items_ids returns nothing.

Viewing 1 replies (of 1 total)
  • The topic ‘Sort Most Liked Posts in custom query?’ is closed to new replies.