Read more button linking to URL

This topic contains 8 replies, has 2 voices, and was last updated by  Jari Laari 9 years, 8 months ago.

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #11039

    Hello,

    We are using ical-plugin and wallflux.com-service to get our Facebook events to events organiser. Wallflux is proving URL-attribute for ical events. This URL gives link back to Facebook.

    Could it be possible to have “More information” button below event organiser post (event-meta-event-single.php), which could redirect to URL given in ics-feed?

    Example feed: http://www.wallflux.com/events/363719408882

    Jari Laari
    #11048

    Hi Jari,

    It’s certainly possible to add more information the standard event details. Simply copy event-meta-event-single.php into your theme and edit there. As for getting this additional information from the feed, that’s not possible (currently).

    However, in the next update will add the ability which other fields you want stored.

    To do this, you’ll need to specify which attribute you want to store, and what meta key (custom field) to store it under. This is done by filtering the $meta_key_map (see below:)

    //iCal synx 1.4 only!
    add_filter( 'eventorganiser_ical_sync_meta_key_map', 'jari_store_facebook_url' );
    function jari_store_facebook_url( $meta_key_map ){
         //$meta_key_map is an array indexed by iCal attributes for an event (lowercased)
         //The value is the meta key
         $meta_key_map['url'] = 'facebook_url';
    
         return $meta_key_map;
    }

    Then in the template:

    echo sprintf( '<a href="%s"> View on Facebook </a>', get_post_meta( get_the_ID(), 'facebook_url', true ) );

    The url will be one of the default attributes stored, and will be stored up the meta key: _event_ical_url. You can change that if you like (it’s not otherwise used by Event Organiser), or instead of doing all the above, just use:

    echo sprintf( '<a href="%s"> View on Facebook </a>', get_post_meta( get_the_ID(), '_event_ical_url', true ) );

    in your template. This data will only be present once the feed as been synced after updating.

    Additionally there will be other hooks added:

    • eventorganiser_ical_sync_event_inserted – passes event ID, event (iCal) array and feed ID, when an event is created from a feed.
    • eventorganiser_ical_sync_event_updated – passes event ID, event (iCal) array and feed ID, when an existing event is updated from a feed.

      which means there’s more than one way to crack this particular nut.

    Stephen Harris
    #11058

    Did I understood correctly example you writed is only for saving static information (not from feed) to event? Where that first function should be saved?

    Do you have any estimation when new update will be announced? In class-eo-ical-parser.php there seems to be already some implementation for handling URL-attribute from ical-feed 😉

    Jari Laari
    #11059

    Probably end of next week.

    Yes, the url is collected from the feed, but it’s not stored. So the data is effectively lost. In the next update the url will be stored as event meta data. Additionally the above code allows you to save other data collected from the feed to the event’s meta data (the example I gave is of the url, but that will be stored anyway…)

    The function jari_store_facebook_url() (if required) should be in a utility plug-in or functions.php. In your case, however, you would just need to add the following wherever you wanted to display the url:

     echo sprintf( '<a href="%s"> View on Facebook </a>', get_post_meta( get_the_ID(), '_event_ical_url', true ) );
    Stephen Harris
    #11067

    Thanks for the great support 🙂 I am looking forward to the update.

    Jari Laari
    #11573

    Is saving event meta data from feed possible yet in latest version (2.8.2)?

    Jari Laari
    #11581

    Hi Jari,

    The change needs to be made in the iCal extension (1.4) – due to be released over this weekend. Apologies for the delay!

    Stephen Harris
    #11614

    Just a note that Event Organiser iCal sync 1.4.0 has since been released.

    Stephen Harris
    #12132

    Thanks. This works great =)

    <?php echo sprintf( ‘View on Facebook ‘, get_post_meta( get_the_ID(), ‘_event_ical_url’, true ) ); ?>

    Jari Laari
Viewing 9 posts - 1 through 9 (of 9 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.