I have made a custom post type Named Team. In this custom post, there are many custom fields for a single team. Now, I am creating a shortcode which will show the posts based on two factor.
1. Points – Point of the teams
2. NRR – Net run rate of the team.
First condition is that the team with highest point should be fetched first. This is going well till two teams appear with same point (say 10 points for both). Now, if this situation arises; NRR is compared next and the team having highest NRR gets to rank first.
I am using following arguments for WP_Query
$args = array ( 'post_type'=>'team', 'posts_per_page'=>-1, 'orderby' => 'meta_value_num', 'meta_key' => 'pts' );
Thanks in Advance