Support » Plugin: Events Manager » events.ics links to events/%event%

  • Resolved takuya


    I can view a single event page without having problems, but when I looked into events.ics while ago I found URL doesn’t work properly.

    It’s supposed to be

    But on events.ics:

    I’ve refreshed the permalink by cliking save a few times, but still events.ics links to a strange url which doesn’t exist…

Viewing 4 replies - 1 through 4 (of 4 total)
  • I checked events.ics template (ical-event.php), and thought #_EVENTURL wasn’t working. However, I confirmed it’s working properly by inserting the shortcode (#_EVENTURL) to one of event posts.

    I wish to manually trigger creation of events.ics, but still can’t figure out how and where generated events.ics file is saved.

    It looks like this plugin doesn’t support changing of its permalink structure by functions.php. If you change plugin’s permalink structure to other type like %post_id% (in this plugin’s case, %event_id%), the plugin doesn’t output correct URL within events.ics.

    Here’s what I’ve written into functions.php in order to change permalink from postname to postid. The code is not originally written, but by some other genius wp user whom I’m thankful for providing the code.

    add_action('init', 'event_rewrite');
    function event_rewrite() {
        global $wp_rewrite;
    	$queryarg = 'post_type=event&p=';
        $wp_rewrite->add_rewrite_tag('%event_id%', '([^/]+)',$queryarg);
        $wp_rewrite->add_permastruct('event', '/events/%event_id%', false); }
    add_filter('post_type_link', 'event_permalink', 1, 3);
    function event_permalink($post_link, $id = 0, $leavename) {
        global $wp_rewrite;
        $post = &get_post($id);
        if ( is_wp_error( $post ) )
    	return $post;
        $newlink = $wp_rewrite->get_extra_permastruct($post->post_type);
        $newlink = str_replace('%'.$post->post_type.'_id%', $post->ID, $newlink);
        $newlink = home_url(user_trailingslashit($newlink));
        return $newlink;
    Plugin Author Marcus


    NetWebLogic Support

    WP won’t allow the use of %…% style placeholders when choosing a permalink structure, this only works for normal posts and not custom post types. It’s not an EM limitation, but a WP one.

    that said, you can still use PHP to make this happen so if your code works for your specific structure, well done 🙂

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘events.ics links to events/%event%’ is closed to new replies.