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
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
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
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
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 11 years ago by Brent Barkley.
Brent Barkley
Hi Brent,
Yes, that’s a known issue. I hope to address this in 2.7.
Stephen Harris
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