Support » Plugin: Events Manager » how to filter em_events by attributes?

  • Resolved nicmare


    i am trying to display events which have a specific attribute only. this does not work:

    if (class_exists('EM_Events')) {
    	echo EM_Events::output( array(
    		'recurring'=> 0,
    		'meta_key' => 'Home'
    		'meta_value' => 'yes'
    	) );

    as you can see, i just want to display those events which have the attribute “Home” set to “yes” as shown here:

    any ideas? THANKS!

Viewing 6 replies - 1 through 6 (of 6 total)
  • You’re missing a coma after the ‘Home’ part.

    Yea thats right but even with comma it won’t work

    A better way to do this might be to use a modified WP query. This is untested but something like this should work:

    $args = array(
    		'post_type' => 'event',
    		'meta_key' => 'Home',
    		'meta_value' => 'yes');
    	$query = new WP_Query( $args );

    …and then into a normal Loop.

    These code examples might help:

    yep. thats the ONLY way it would work. already found and tested this solution BUT it does not support the “recurring” paramter :(. i want the best from both worlds: recurring and meta_key 😀

    you can add event-recurring


    'post_type' => 'event,event-recurring',

    ah nice. i did not know about that. thats my final wp_query:

    new WP_Query(array(
    	'post_type' => 'event-recurring',
    	'posts_per_page' => 5,
    	'meta_key' => 'Home',
    	'meta_value' => 'yes'

    this shows me one instance of a recurring event with the custom post type “Home” and value “yes”. perfect.
    thank you angelo!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘how to filter em_events by attributes?’ is closed to new replies.