Ciao,
Where do you want to display the events? On the search page or somewhere else?
Hi,
i want to show the events on my home page, and events listings page, also on the search page. so any where in my website i want to show the events based on the city selected from the drop-down menu.
this is my website
http://www.grancapodanno.com/
Hi angelo,
Thanks for the answer
i don’t to be do it with shortcode, i need to do it with custom wp_query, is this is possible ?? kindly let me know
You should be able to do that. I don’t have any sample code handy, but you’d want to check location_town in the wp_em_locations table.
Hi caimin_nwl,
thank you so much for the reply
What i have to do now?? without location_town in the wp_em_locations table how can i get it??
Hi angelo and caimin_nwl
Can you help me on this, i tried to get the events by location state, but i can’t get the result
We can write the tax and meta query because the location town doesn’t in the terms and metadata table, so i don’t have any idea to get the events by the location state or town
Can you post the code you’ve got so far?
Hi caimin_nwl,
Thank you so much for your kind reply,
i got it myself by adding the filters for the query by following code
function my_custom_join($join){
global $wpdb;
$Eventtable = $wpdb->prefix."em_events";
$Locationtable=$wpdb->prefix."em_locations";
$poststable=$wpdb->prefix."posts";
$join .= " JOIN $Eventtable ON $Eventtable.post_id = $poststable.ID";
$join .= " JOIN $Locationtable ON $Locationtable.location_id = $Eventtable.location_id";
remove_filter( current_filter(), __FUNCTION__ );
return $join;
}
function my_custom_where($where){
global $wpdb;
$Eventtable = $wpdb->prefix."em_events";
$Locationtable=$wpdb->prefix."em_locations";
$poststable=$wpdb->prefix."posts";
if(!empty($_COOKIE['my_cookie_city_code']))
{
$state=$_COOKIE['my_cookie_city_code'];
}
else
{
$state='';
}
if($state!="")
{
$where .= " AND $Locationtable.location_state = '$state'";
}
remove_filter( current_filter(), __FUNCTION__ );
return $where;
}