Show calendar view on 2 sites

This topic contains 3 replies, has 2 voices, and was last updated by  Mike Rawlins 9 years, 10 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #16878

    Is it possible to show the event calendar on 2 sites?

    I’m currently running an events calendar as part of a community site but also have a .events domain. I’m thinking of moving the events management & submission on to the .events domain but would still want to show the calendar on the events page of the community site.

    Mike Rawlins
    #16891

    There is an oembed feature planned by which you can embed (for example) a calendar from a site using Event Organiser in another site. This feature is at the early planning stages, and there’s no ETA yet.

    In the mean time, it is possible to achieve this by having your community site subscribe to the iCal feed or your events site. That will automatically pull-in events form the events site. You can then display a calendar of those events. There are a couple of drawbacks:

    • iCal feeds don’t contain all event data (e.g. venue address). These would have to be manually entered for each venue. This is a limitation of the iCal specification.
    • The events are duplicated across two sites. You can do one of two things. Set up a redirect from events on the main site to the events site or use a filter to change the event link (to that of the events site). The latter is most straightforward, however you may want to consider setting up a permanent redirect in your .htaccess so that users who try to access an event on the main site directly are taken to the events site. (If this might be a problem). Imported events have their original url (as given in the iCal feed) stored as post meta with the key: _event_ical_url.
    Stephen Harris
    #16892

    To provide a snippet for (2) above:

    //NOTE: You will need to clear the cache for changes to the calendar to take 
    //affect. You can  do this by updating an event.
    add_filter( 'post_type_link', function( $permalink, $event ){
    
        if( 'event' != get_post_type( $event ) ){
            return $permalink;
        }
    
        $original_url = get_post_meta( $event->ID, '_event_ical_url', true );
    
        if( $original_url ){
            $permalink = $original_url;
        }
    
        return $permalink;
    
    }, 11, 2 );
    
    Stephen Harris
    #16893

    Thanks for the update.

    oembed looks like the way forward (at some point). I may just try a simple iframe in the page to start with so links will automatically go to the right place.

    Thanks

    Mike Rawlins
Viewing 4 posts - 1 through 4 (of 4 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.