Reputation: 5761
I want to make custom search
This is the output url from the form http://alessandro.host/?country=Italy&area=Milan&type=luxury-hotels
and this is the explanation:
post_meta
post_meta
how i can make this custom search?
Upvotes: 1
Views: 1492
Reputation: 30461
I'd check out scribu's explanation of advanced metadata queries in WordPress 3.1 to help you: http://scribu.net/wordpress/advanced-metadata-queries.html
Also, take a look at WordPress's documentation on WP_Query: http://codex.wordpress.org/Function_Reference/WP_Query
In your case, it sounds like all you'd need is something like this:
<?php
$country = $_GET['country'];
$area = $_GET['area'];
$type = $_GET['type'];
query_posts( array(
'category_name' => $type,
'meta_query' => array(
array(
'key' => 'country',
'value' => $country,
),
array(
'key' => 'area',
'value' => $area,
)
)
) );
// now do the loop as normal
?>
Upvotes: 2