• Resolved ShMk

    (@shmk)


    Hello,
    I’m retrieving an array of events using
    EM_Events::get();
    but in the events object returned I can find many event infos but not event categories, tags and locations.

    What is the correct method to get an array of events and the relative event categories, tags and locations?

    I’m on a multi-site installation with categories and locations shared between websites and tags limited to single blog.

    Thanks in advance

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

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter ShMk

    (@shmk)

    Am I the only one with this problem?

    Maybe an error in my plugin settings? Or in the multi-site install?

    Hi,

    Sorry we missed your questions earlier – can you post the code you’re using?

    Thread Starter ShMk

    (@shmk)

    I’m using this code to get an array of event objects:

    $events = EM_Events::get(array(
    	'blog' => get_current_blog_id(),
    	'limit' => 20,
    	'order' => 'DESC',
    	'orderby' => 'event_start_date,event_name',
    	'scope' => $dates,
    	'category' => $categories,
    	'tag' => $tags
    ));

    and as said before: I’m on multisite environment and I cannot see categories (field presents but empty), tags and locations (missing fields) in the returned objects fields.

    Plugin Support angelo_nwl

    (@angelo_nwl)

    you can try

    $events = EM_Events::get(array(
    	'blog' => get_current_blog_id(),
    	'limit' => 20,
    	'order' => 'DESC',
    	'orderby' => 'event_start_date,event_name',
    	'scope' => $dates,
    	'category' => $categories,
    	'tag' => $tags
    ));
    
    foreach ($events as $EM_Event){
    
      $locations  =   $EM_Event->get_location();
      $categories =   $EM_Event->get_categories();
    
    }
    Thread Starter ShMk

    (@shmk)

    Thanks, it worked for location and categories 🙂

    Are there any function for tags too? Or I have to use standard wordpress functions?

    Plugin Support angelo_nwl

    (@angelo_nwl)

    with regards to tags, you can see that under templates/placeholders/eventtags.php

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Get event categories, tags and locations’ is closed to new replies.