I am using the Like/Dislike plugin on a custom post type and am trying to order the display of posts by the most like count down to those that have no likes (and no set meta value in the posts meta table).
My current query is the following:
$args = array(
'post_type' => 'idea',
'post_status' => 'publish',
'posts_per_page' => -1,
'meta_key' => 'pld_like_count',
'orderby' => 'meta_value_num title',
'order' => 'DESC'
);
This displays only the posts that have a defined meta_key and meta_value for the Like/Dislike plugin.
Is there a way to order posts from the most likes down to those without the defined meta_key/value?
Posts without a set like meta_key/value still need to be displayed because users need to be able to like the posts with the button.
posts_per_page
to-1
, and instead, use a fixed number that the database can handle at once.