INVP::have_new_and_used_vehicles()
Checks if there are both ‘new’ and ‘used’ vehicles in the inventory.
Return Return
(bool) True if both new and used vehicles exist, false otherwise.
Source Source
File: includes/class-invp.php
public static function have_new_and_used_vehicles() {
$new_query = new WP_Query(
array(
'post_type' => self::POST_TYPE,
'post_status' => 'publish',
'posts_per_page' => 1,
'tax_query' => array(
array(
'taxonomy' => 'condition',
'field' => 'slug',
'terms' => 'new',
),
),
)
);
$used_query = new WP_Query(
array(
'post_type' => self::POST_TYPE,
'post_status' => 'publish',
'posts_per_page' => 1,
'tax_query' => array(
array(
'taxonomy' => 'condition',
'field' => 'slug',
'terms' => 'used',
),
),
)
);
return ( $new_query->have_posts() && $used_query->have_posts() );
}
Expand full source codeCollapse full source codeView on Github