eo_get_event_fullcalendar exclude?

This topic contains 6 replies, has 2 voices, and was last updated by  Brent Barkley 10 years, 3 months ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #8503

    Hey Stephen,

    Thanks again for all your help/support. I’m trying to exclude categories from a custom eo_get_event_fullcalendar() that I’m using in a page template. Is there a way to exclude a category in the args? I’ve tried including them as an array or as a string with commas between the categories, and neither seems to work to include multiple.

    I need to exclude one category from my calendar view. Here’s the function I’m using. The only other way I can think of to do this would be to do a do_shortcode() in my template, but wanted to see if it was doable this way. Hoping it’s just a syntax issue.

    function eo_get_event_fullcalendar_custom( $args ){

    $defaults = array(
    'headerleft'=>'prev category', 
    'event_category'=> 'extreme-theater,events,classes-activities');
        //I've also tried this
       // 'event_category'=> array('extreme-theater','events','classes-activities')
    $args = shortcode_atts( $defaults, $args, 'eo_fullcalendar' );
    Brent Barkley
    #8507

    Hi Brent,

    Your welcome :). And no need to use do_shortcode(), there is a function for displaying the calendar too: codex.wp-event-organiser.com/function-eo_get_event_fullcalendar.html

    Something like the following should work:

    echo eo_get_event_fullcalendar(array( 
        'event_category' => 'sport,theatre', //Displays categories sport & theatre
    ));

    It’s inclusive, so it’ll display events which are in either sport or theatre (or both).

    Note: That the key is “event_category” rather than the usual “event-category” is a hangover from the fact shortcode attributes can’t contain a hyphen. That the value a comma delimited string rather than an array, array( 'sport','theatre' ) is due to the fact that’s how multiple values can be specified in a shortcode. This will change, but backwards compatability will be maintained. As such, feel free to use the above, but for any version after 2.6 you’ll be able to use:

    echo eo_get_event_fullcalendar(array( 
        'event-category' => array( 'sport', 'theatre' )
    ));

    instead, which is much nicer.

    Stephen Harris
    #8524

    Thanks, Stephen. This isn’t working for me though. When I use the following code, it still shows all the categories. I have updated to 2.6. Also, I used the event_category with comma delimited and the new event-category, and both showed all the categories. This doesn’t have to do with having EO Pro installed, right?

    <?php echo eo_get_event_fullcalendar(array(
    'headerleft'=>'prev category', 
    'headercenter'=>'title', 
    'headerright'=>'next', 
    'defaultview'=>'month',
    'event-category'=> array('extreme-theater', 'events', 'classes-activities')

    )); ?>

    Brent Barkley
    #8535

    The update in API will only happen on 2.7. But

    echo eo_get_event_fullcalendar(array( 
        'event_category' => 'sport,theatre', //Displays categories sport & theatre
    ));

    should work. Are you able to provide a link to the page you’re using this on (if you don’t want to make this public, feel free to use this form)?

    The fact you’re using Pro shouldn’t affect anything with regards to the calendar.

    Stephen Harris
    #8546

    Weird, now that worked. Thanks!

    But one weirdness–if you have the filter on there, it still lists categories you excluded. Anything that can be done there? Thanks for your help.

    • This reply was modified 10 years, 3 months ago by  Brent Barkley.
    Brent Barkley
    #8575

    Hi Brent,

    Yes, that’s a known issue. I hope to address this in 2.7.

    Stephen Harris
    #8592

    Cool. Thanks for your great support. Just for fun, I tried removing with jQuery:

    $(“#eo-event-cat option[value=’exhibits’]”).remove();

    But I think the fact that the calendar takes a second to load is keeping it from working. I’ll have to play around with it, but I can wait for 2.7 in the meantime. 🙂

    Brent Barkley
Viewing 7 posts - 1 through 7 (of 7 total)
To enable me to focus on Pro customers, only users who have a valid license for the Pro add-on may post new topics or replies in this forum. If you have a valid license, please log-in or register an account using the e-mail address you purchased the license with. If you don't you can purchase one here. Or there's always the WordPress repository forum.