I am trying to get posts of custom post type 'job_listing' on bases of two custom fields i.e 1) _job_location 2) _company_name
this is working fine
but I also want to display the posts first that are from the given company i.e if the posts belong to XYZ company then they should be displayed first and then the rest of posts from the given location
$related_args = array(
'post_type' => 'job_listing',
'orderby' => $company_name,
'meta_key' => '_company_name',
'posts_per_page' => 6,
'post_status' => 'publish',
'post__not_in' => array( $post->ID ),
'meta_query' => array(
'relation' => 'OR',
array(
'key' => '_job_location',
'value' => $job_location,
),
array(
'key' => '_company_name',
'value' => $company_name,
),
),
);
My sorting logic is wrong and I can seem to find out the solution .. so please help me out