RSS feed wrong time

Home Forums Calendar Products Events Calendar PRO RSS feed wrong time

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #926687
    Frederique
    Participant

    I already discovered some of the same issues, but can’t figure out how to get it working. Where do I change the code?

    And do I need to change it everytime during winter and summer?

    #926779
    Geoff
    Member

    Hi there, Frederique! Thanks for reaching out and sorry you’re bumping into some problems with the event times in RSS.

    I do see that we have a ticket logged for this issue and are working on it for an upcoming release. In the meantime, you can try adding this snippet to your theme’s functions.php file:

    add_filter( 'get_post_time', 'events_rss2_gmt_pubdate_correction', 20 , 3 );
    
    function events_rss2_gmt_pubdate_correction($time, $d, $gmt) {
    global $post;
    
    // Don't interfere if this is not the events feed
    if ( $post->post_type != TribeEvents::POSTTYPE || ! is_feed() || ! $gmt ) return $time;
    
    // Don't interfere if the timezone hasn't been set
    $zone = get_option( 'timezone_string', false );
    if ( false === $zone ) return $time;
    
    // Get time and timezone
    $time = new DateTime( tribe_get_start_date( $post->ID, false, $d ) );
    $zone = new DateTimeZone( $zone );
    
    // Apply timezone and calculate offset
    $time->setTimezone( $zone );
    $offset = $zone->getOffset( $time );
    $offset *= -2;
    
    // Apply correction
    $time->modify( "$offset seconds" );
    $time = $time->format( TribeDateUtils::DBDATETIMEFORMAT );
    $time = mysql2date( $d, $time );
    
    return $time;
    }

    In most cases, you can paste snippets like this at the very bottom of the functions.php file. You can locate your functions.php file either in your theme directory files, or by logging into WordPress and heading over to Appearance > Editor and selecting the “Theme Functions” link from the right sidebar.

    Give that a shot and let me know if it helps. 🙂

    Cheers!
    Geoff

    #928871
    Geoff
    Member

    Hi there, Frederique! Just checking in to see if there’s been any other update or if you still need assistance on this one–please let me know. 🙂

    Cheers!
    Geoff

    #931878
    Frederique
    Participant

    Hi,

    Finally I got the time (and the right mindset) to try to solve the issue. When I try to post the code, I get an error when trying to reed the rss.

    This page contains the following errors:
    
    error on line 24 at column 12: Extra content at the end of the document
    Below is a rendering of the page up to the first error.

    So I deleted the code as well.

    The strange thing is: on the website it turns out to be great, but in the app, where the rss is loaded, it goes wrong.
    Is there a way to get the featured images in the rss as well?

    #932064
    Geoff
    Member

    Hey Frederique! Thanks for following up.

    Sorry the snippet is giving you some trouble. I just tried it out on my local site and it seems to work smoothly, so it’s likely that it needs to be placed elsewhere in your theme’s functions.php file so it doesn’t conflict with the formatting of other functions.

    I think it would be possible to include the Featured Image in the Event RSS Feed, but I’m afraid it will take some custom development to get it going. There is a tutorial on how to add Events to your site’s main RSS Feed that might help get you started, but it’s unfortunately something that isn’t supported out of the box.

    Please let me know if you have any other follow-up questions. 🙂

    Cheers!
    Geoff

    #934780
    Geoff
    Member

    Hey there, Frederique! Just checking in to see if you had any additional follow-up questions or still need assistance on this one–please let me know. 🙂

    Cheers!
    Geoff

    #936220
    Geoff
    Member

    By the way, one of my colleagues here on the team came up with a snippet that might help address the RSS feed time issue you’ve been having. Give this a shot and let us know if it helps make a difference.

    https://gist.github.com/geoffgraham/97066b8915f588aa0fad

    Cheers!
    Geoff

    #937052
    Frederique
    Participant

    Yeah, this works! I had to change the -7 into -1, but it works 🙂

    #937577
    Geoff
    Member

    That is awesome! I’m glad that did the trick. 🙂

    I’ll go ahead and close this thread but please feel free to start a new one if anything else comes up and we’d be happy to help.

    Cheers!
    Geoff

    #988056
    Leah
    Member

    Hello,

    Thank you again for bringing this issue to our attention. We’re happy to say that we have added a fix for this into our upcoming version 3.11 release. Keep an eye on your Updates page for the new version. If you have any trouble with the update (or are still seeing this problem after you update) please start a new thread and we’d be happy to help out.

    Thank you for your patience while we got this release ready to go!

    Best,
    Leah
    and the rest of The Events Calendar team

Viewing 10 posts - 1 through 10 (of 10 total)
  • The topic ‘RSS feed wrong time’ is closed to new replies.