Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #5158
    there there
    Participant

    Hey there,

    thanks for the great plugiN! :)

    I adding this plugin to my theme and because of that i’m doing some customization.

    I want to list events from only one category, or from specific ones. Or from some and not others.

    Im trying this way (show only events from category one) , but it still list all events.

    $args = array(
    ‘post_type’ => ‘event’, // required
    ‘suppress_filters’ => FALSE, // required
    ‘posts_per_page’ => -1 // optional
    ‘cat’ => 1,
    );

    $events = new WP_Query($args);
    ?>

    <?php while ( $events->have_posts() ) : $events->the_post();

    #5192
    Bartosz
    Keymaster

    This will not work because you’re using ‘cat’. Event category is not the same as blog category – it’s a custom taxonomy named ‘event-category’.

    Of course you can run any type of query here but you need to use ‘tax_query’ parameter as it’s described in WP_Query class in WP codex.

    #6539
    David Magenheimer
    Participant

    Ok, so maybe I’m a little dense. I’m running WP 4.2.2 and Event Maker 1.6.1. I’m trying to use em_get_events().

    $args = array(
    ‘number_of_events’ => 5,
    ‘tax_query’ => array(
    ‘taxonomy’ => ‘event-category’,
    ‘field’ => ‘name’,
    ‘terms’ => ‘frontPageEvent’,
    ‘include_children’ => false,
    ‘operator’ => ‘IN’
    ),
    ‘post_status’ => ‘publish’);

    $fpEvents = em_get_events($args);

    In my test case I have one event placed into two event_category items. I’m trying to get only future events (no past events). However, for some reason I’m not getting any events from the query.

    Any help / pointers are much appreciated.

    Thanks,
    David M.

    #6544
    Bartosz
    Keymaster

    What does em_get_events() function without any parameters return?

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.