Url in Ical

This topic contains 5 replies, has 2 voices, and was last updated by  Stephen Harris 3 months, 2 weeks ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #29874

    Hi,
    I did setup an ics-import and the url-field of the ics is filled with the url of the originating event, this event is not on my own website.

    I would like to setup the widget event-list so that when an user clicks the event he will not get directed to the imported event but to the original event, using the url-field of the ics-feed.

    is this possible?

    Frans Bosman
    #29875
    Frans Bosman
    #29887

    Hi Frans,

    This code snippet will do that. Please note it changes all the links for that event, not just the widget:

    add_filter('post_type_link', function($url,$event){
    
            if('event' != get_post_type($event)){
                    return $url;
            }
    
            $ical_url = get_post_meta($event->ID, '_event_ical_url', true);
    
            if($ical_url){
                    return esc_url_raw($ical_url);
            }
    
            return $url;
    
    },10,2);
    
    Stephen Harris
    #30023

    Hi Steven,

    I did apply your snippet in functions.php, but the resulting url is not correct, it appends the url I want to the url of the site event organiser is running:

    http://vanginkel.fbosman.nl/%3Chttp:/calypsotheater.nl/k/n394/news/view/3322/3090/familiefilm-k3-love-cruise-met-k3-disco.html

    I want “http://vanginkel.fbosman.nl/%3” not included, what did I do wrong?

    regards,

    Frans

    Frans Bosman
    #30024

    Hi,
    I did solve this issue, made a typo in the php-script.

    sorry for the inconvenience

    regards,

    Frans

    Frans Bosman
    #30028

    Glad that’s working for you now 🙂

    Stephen Harris
Viewing 6 posts - 1 through 6 (of 6 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.