• Resolved Jaakko P?ntinen

    (@jpontinen)


    Hi again ??

    I’d like to ask for more help, still. I’ll try to pipe down after this one. Everything is perfect so far – one more thing.

    I’d like the pubdate in the RSS to be populated from the event start date, not the WP post publish date or recently modified date, which ever it is. Also, it would be nice that the pubdate would be sent for translation; we will only ever use the feeds for our Finnish customers.

    1. How to inject event start date as pubdate in the feed?
    2. How to set pubdate so that it would be translated?

    Thank you again.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Hi @jpontinen,

    You can use this hook

    add_action('event_fee_item_end','your_theme_name_custom_event_field_value');
    function your_theme_name_custom_event_field_value(){
       the_modified_date('F j, Y');
    }

    This will be improved in the future.
    Thank you

    Hi @jpontinen,

    Please update with following code

    add_action('event_fee_item_end','your_theme_name_custom_event_field_value');
    function your_theme_name_custom_event_field_value(){
    echo "<event_listing:publish-date><![CDATA[" . esc_html( get_the_modified_date( $d ) ) . "]]></event_listing:publish-date>\n";
    
      
    }
    Thread Starter Jaakko P?ntinen

    (@jpontinen)

    Hello,

    Yes, that pushes event metadata into the feed, but my concern is the primary pubDate of the RSS item, such as:

    <pubDate>Mon, 22 Apr 2019 21:00:00 +0000</pubDate>

    This is the value I’d like to see populated with the start date/time of the event in each feed item ??

    – JP

    Hi @jpontinen,

    add_action('event_fee_item_end','your_theme_name_custom_event_field_value');
    function your_theme_name_custom_event_field_value(){
    $start_date = get_event_start_date();
    echo "<pubDate><![CDATA[" . esc_html(date('l, j F Y H:i:s O',strtotime($start_date))  ) . "]]></pubDate>\n";
    
    $end_date = get_event_end_date();
    
    echo "<pubDate><![CDATA[" . esc_html( date('l, j F Y H:i:s O',strtotime($end_date))  ) . "]]></pubDate>\n";
      
    }

    I made a sample code without testing. Please check and adjust if there is anything missing.
    Thank you

    Thread Starter Jaakko P?ntinen

    (@jpontinen)

    Hello!

    This produces a pubDate reading that feed readers can and will show, thank you! I modified the code as follows to get both date and time with the correct time offset to show:

    $start_date = get_event_start_date();
    $start_time = get_event_start_time();
    $start_all = "$start_date " . "$start_time";
    echo "<pubDate>" . esc_html(date('l, j F Y H:i:s +0300',strtotime($start_all))  ) . "</pubDate>";

    However, RSS is still fighting back. The original pubDate element stays in the feed, and feed readers either take only the first one and show it (which is, again, the date the event post was made) OR, stupidly, just take both of them and slap them together like this: Wed, 08 May 2019 21:00:00 +0000Thursday, 12 September 2019 19:00:00 +0300

    The latter one of those is the correct one that I’d like to show!

    But it seems that without somehow altering how the feed gets printed by WordPress to begin with, this is not doable from within your plugin ?? Sadly!

    Thank you for all your help. You’ve been outstanding. Now I’m set with a recipe for the pubdate injection. I’ll need to find out how to alter the default WordPress RSS feed and check if the feed being created is an WP Event Manager feed and if it is, change the way the pubDate is printed.

    All feeds from our WP cannot be modified, as we have news feeds as well, which rely on the pubDate being the post publication date. No need to modify that…

    This is endless ^^ Heh.

    Thank you!

    Hi @jpontinenm
    In next release, I will check RSS feed in deep and we will improve this.

    Thank you

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘RSS pubdate change’ is closed to new replies.