WordPress.org

Forums

Events Manager
[resolved] get events based on location taxonomies (6 posts)

  1. jothikannan
    Member
    Posted 1 year ago #

    Hi,

    how to get the events based on the locations taxonomies,

    i have created a custom taxonomy for location post type, and now i want to get the events based on the location taxonomy i have created, am trying with the custom wp query as

    $args = array('post_type' => 'event','post_child'=>'location',
                     'tax_query' => array(
                    array(
                    'taxonomy' => 'kind_of_location',
                    'field' => 'slug',
                    'terms' => 'restuarant'
                    )
                    )
                     );
    $my_query = new WP_Query($args);

    but it doesn't returning anything, what is wrong here, post_child works here ? or how can i get it?

    http://wordpress.org/plugins/events-manager/

  2. caimin_nwl
    NetWebLogic Support
    Posted 1 year ago #

    Hi,

    I'm not really clear on what you're trying to do here. If you can explain a bit more we might be able to help.

    I can see you've misspelled the word restaurant - that might be your problem.

  3. jothikannan
    Member
    Posted 1 year ago #

    Hi,

    i think that the event and locations are custom post types? and i thinking that location is child post of event, am i right?

    so i have created custom taxonomy for location custom post type, the taxonomy is kind of location(kind_of_location) like bar, hotel,etc, and while add a location i can choose these kind of location

    so i have write the custom query like below to link the location and events with the tax_query and post_child

    $args = array('post_type' => 'event','post_child'=>'location',
                     'tax_query' => array(
                    array(
                    'taxonomy' => 'kind_of_location',
                    'field' => 'slug',
                    'terms' => 'restuarant'
                    )
                    )
                     );
    $my_query = new WP_Query($args);

    i hope you may understand now

  4. caimin_nwl
    NetWebLogic Support
    Posted 1 year ago #

    The post types event and location are independent, location isn't a child of event.

    Maybe that's where you're going wrong - the post_child'=>'location' bit doesn't make any sense.

    Also, unless you've misspelled restaurant as restuarant in your taxonomy that's not going to work.

  5. jothikannan
    Member
    Posted 1 year ago #

    OK thanks,

    my taxonomy is restuarant there is no problem with it, so problem is post_child, i thought that the location is child of event post type, may i know there is any relation between these??

    there is any possible way to get the events that attached with a location and the location taxonomy,??

    can you understand what i want to do? really i want to do it

  6. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 1 year ago #

    I think you can do this if you use our shortcodes, see this tutorial for more info:

    http://wp-events-plugin.com/tutorials/using-additional-custom-taxonomies/

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Events Manager
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic