wp_query for events with favorite city
-
Hello,
I want to assign favorite city to a user. And at some point i’d like to ask user about his favorite city available form cites assinged to location. Just like on search page where you have <option> of cities.
My idea id that on index page i have some main or featured content and i’d like to make a query which take user favorite city and list only this events wich take place there.
Id like to ask for it with meta query (or other way?) by stored cookie or whatever. I search everywhere and cant fint is or my approach is not so good. But if it possible in that way it will be awesome.
My basic first query (i have some on main page) is:
——-
$args0 = array(
‘post_type’ => ‘event’,
‘posts_per_page’ => ‘6’,
‘meta_query’ => array(
array(
‘key’ => ‘_start_ts’,
‘value’ => current_time(‘timestamp’),
‘compare’ => ‘>=’,
‘type’=>’numeric’
),
array(
‘key’ => ‘polecane’,
‘value’ => ‘tak’
)
),
‘orderby’ => ‘meta_value_num’,
‘order’ => ‘ASC’,
‘meta_key’ => ‘_start_ts’,
‘meta_value’ => current_time(‘timestamp’),
‘meta_value_num’ => current_time(‘timestamp’),
‘meta_compare’ => ‘>=’,
);
$the_query = new WP_Query( $args0 );
——Ragards
- The topic ‘wp_query for events with favorite city’ is closed to new replies.