$term1 = $_GET['s'];
//var_dump($term1);
$term2 = $_GET['type_contrat'];
$term3 = $_GET['lieu'];
$hello = explode('-(', $term3);
array_splice($hello, 1);
$term3 = implode("", $hello);
echo "Recherche pour la la catégorie : " . $term2 . "
";
// $args = array(
// 'post_type' => 'offres_emploi',
// 's' => $term1,
// 'tax_query' => array(
// array(
// 'taxonomy' => 'type_de_contrat',
// 'field' => 'slug',
// 'terms' => array( $term2 )
// ),
// )
// );
$args = array(
'post_type' => 'offres_emploi',
'field' => 'slug',
'terms' => array( $term1 ),
'tax_query' => array(
//'relation' => 'AND',
array(
'taxonomy' => 'type_de_contrat',
'field' => 'slug',
'terms' => array( $term2 ),
),
array(
'taxonomy' => 'lieu',
'field' => 'slug',
'terms' => array( $term3 ),
'compare' => 'LIKE',
),
)
);
$loop = new WP_Query($args);
if($loop->have_posts()) {
$term = $wp_query->queried_object;
echo ''.$term1.'
';
while($loop->have_posts()) : $loop->the_post();
//Output what you want
echo ''.get_the_title().'';
endwhile;
}
?>
$terms = [];
$contrat = $_GET['type_contrat'];
$lieu = $_GET['lieu'];
$job = $_GET['s'];
$terms = [$contrat, $lieu, $job];
$terms_splite = implode(", ", $terms);
echo "
" . $terms_splite;
?>
get_footer();?>