Support

Home Forums Events Calendar Add-on Add-on Calendar: Show canceled events on show_expired=true

Add-on Calendar: Show canceled events on show_expired=true

Posted: February 7, 2018 at 1:06 am


motio

February 7, 2018 at 1:06 am

Hi,

we are trying to achieve two calendars 1. all events and 2. only the active events.

We used this snippet to exclude the canceled from the calendar. Can I bring the canceled events back for the show_expired=true shortcode?
https://github.com/eventespresso/ee-code-snippet-library/blob/master/addons/eea-calendar/loc_ee_exclude_certain_event_statuses_from_events_calendar.php

Maybe there is an more elegant way for this.


Josh

  • Support Staff

February 7, 2018 at 8:19 am

Hi motio,

You should be able to alter the code a bit to check for the current page (with the WP is_page() function) then only run that filter on the calendar page that has only the active events.


motio

February 7, 2018 at 9:19 am

Hi Josh,
thank you for the quick reply. I understand what you are saying but unfortunately I am not a coder. I understand the concept, what I have to edit and what code to copy/paste (if it is explained like on your documentation) but I cannot writhe new code. I hoped there would be a quick solution.


Josh

  • Support Staff

February 7, 2018 at 4:44 pm

Can you provide a bit more details about what you’re working on then? If we know the page slug of the page that displays active events, we can show you how to alter the code.


motio

February 8, 2018 at 2:51 am

Hi Josh,

we provide a booking site for courses (pilates, yoga, etc.) for our customer.

The pages /termine/ and /termine-kalenderansicht/ should show all events (active, upcoming, postponed, canceled). The first page uses the table template and the second the calendar shortcode.

On the Page /aktuelle-kurse/ we want to show only the active events (exclude the canceled) with the calendar shortcode.

We really appreciate your efforts.


Josh

  • Support Staff

February 8, 2018 at 11:41 am

Hi Motio,

You’ll still need to alter the code to accomplish this, and here’s another example:

function loc_ee_exclude_certain_event_statuses_from_events_calendar( $public_event_stati ) {
    if( isset( $_GET[ 'show_expired' ] ) ) {
         if( $_GET['show_expired']=='false' ) {
            unset( $public_event_stati[ EEM_Event::cancelled ] );
        }
    }
    return $public_event_stati;
}

add_filter( 
    'AFEE__EED_Espresso_Calendar__get_calendar_events__public_event_stati', 
    'loc_ee_exclude_certain_event_statuses_from_events_calendar'
);

Then, in addition to making the above change, you’ll need to change the shortocode on the page /aktuelle-kurse/ to include the
show_expired=false parameter.
e.g. [ESPRESSO_CALENDAR show_expired=false]


motio

February 9, 2018 at 2:20 am

Thank you a lot Josh, that works great.

If I could bother you with a second topic. I’ve noticed that that the agendaWeek view is showing the US time format. The time format in the system settings and the calendar add-on settings are set to G:i. On the top left corner it says “all-day”, which I also couldn’t change through the po and mo file.
Did I miss something? I couldn’t find anything in the forum.


Josh

  • Support Staff

February 9, 2018 at 5:30 am

The solution for agendaWeek is to use basicWeek instead. You can change this by going to Event Espresso > Calendar, then find the Header Style > Right field and change agendaWeek to basicWeek, then save the settings.


motio

February 9, 2018 at 6:31 am

So there is no easy solution for that. Unfortunately the basicWeek has no time indication and the events are vertically right next to each other.
If we have on one day only evening events and on the next day only morning events, they would appear next to each other and some could think they are at the same time. That could be confusing for some people. Than I hope the people will understand the am/pm time.
Nevertheless thank you for your support with the code.


Josh

  • Support Staff

February 9, 2018 at 7:19 am

You can add a time indication to the basicWeek view by going to Event Espresso > Calendar then you set Show Event Time in Calendar to Yes, then click Save.

The support post ‘Add-on Calendar: Show canceled events on show_expired=true’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso