WP Query include post title as 'Search' With two custom taxonomies
-
Hi Good day!
I want to customize the search functionality of the website i am currently developing,
I have a text field called ‘Search for: ‘
and two dropdowns:
1st dropdown: ‘Custom Taxonomy 1’
2nd dropdown: ‘Custom Taxonomy 2’
The user will enter his desired keywords and then chooses for the combination of custom taxonomy 1 terms ‘and’ custom taxonomy terms matching that keywords he entered.
I’ve make sure i have pass my parameters correctly using $_GET;
I want to use Worpdress WP Query in this, currently I have this code in my search.php
<?php $args = array( 'tax_query' => array( 'relation' => 'AND', array( 'taxonomy' => 'custom_taxonomy1', /** region **/ 'field' => 'slug', 'terms' => 'my-term1' ), array( 'taxonomy' => 'custom_taxonomy2', 'field' => 'slug', 'terms' => 'my-term2' ) ), 'post_title' => $_GET['s'] ); $listing = new WP_Query( $args ); while ( $listing->have_posts() ) : $listing->the_post(); /** The contents **/ endwhile; ?>
and it seems to ignore my post title.
Thanks.
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘WP Query include post title as 'Search' With two custom taxonomies’ is closed to new replies.