WordPress.org

Ready to get started?Download WordPress

Forums

Events Manager
[resolved] Can't filter out categories v5.1.7 (4 posts)

  1. derekchamberlin
    Member
    Posted 2 years ago #

    Please help!

    I've been looking at this quite a bit and I can't seem to get this working. I've been trying to use the shortcode and the PHP loop code to try to filter out different categories for either a page template or a post / page. I've tried using the following pieces of code (keep in mind they were for different pages so I was trying to filter different categories)

    This is what I used for the page to try to only show category 4. This either showed everything or nothing:

    [events_list category=-1,-2,-3 limit=20 orderby=event_start_date pagination=1][/events_list]

    I also tried the two following pieces of code that I found on the Events Manager website and a support forum. These both either showed everything or nothing as well:

    <?php query_posts( array ( ) );

    if (class_exists('EM_Events')) {
    echo EM_Events::output( array('limit'=>3, 'orderby'=>'event_start_date', 'category'=>-4) );
    } ?>

    <?php echo do_shortcode('[events_list full="1" category="-4" limit=3 orderby="event_start_date"]'); ?>

    On top of trying the exclude category feature, as shown above, I also tried to the opposite by listing all the categories except the ones I wanted to exclude. I haven't had any sort of luck with this. At this point I'm assuming maybe this feature just doesn't work. I'm fairly code savvy, but this is proving to be a real pain. I'd really appreciate some help on this!

    Thanks a bunch in advance!

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

  2. agelonwl
    Member
    Posted 2 years ago #

    have you tried something like this [events_list category="-1,-2,-3" limit="20" orderby="event_start_date" pagination="1"][/events_list] ?

  3. derekchamberlin
    Member
    Posted 2 years ago #

    Hey agelonwl,

    I'd tried the similar code shown above, but after seeing your response, I tried the way that you posted as well. This didn't give me any different results. I really appreciate the help! I'm open to try any different suggestions.

    Thanks again for your help,

    Derek

  4. agelonwl
    Member
    Posted 2 years ago #

    hmm. seems to be working fine on my test site; e.g. [events_list category="-10,-14,-22" limit="20" orderby="event_start_date" pagination="1"][/events_list] this shortcode only shows events with category id 17; Is 1,2,3,4 is your category id? you can see category id by clicking screen options on the top right corner of the page.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic