• Resolved aggk

    (@aggk)


    Hi,

    I’m trying a feed generated from Events Calendar for GeoDirectory where there are fields for event start/end date/time. These fields did not appear when I tried Super RSS Reader. Is it possible, either with free or pro version to display them?
    Here is what the format for these looks like inside the feed items:
    <ev:gd_event_meta xmlns:ev=”Event”><ev:startdate>Mon, 19 Apr 2021 08:00:00 +0000</ev:startdate><ev:enddate>Mon, 19 Apr 2021 16:00:00 +0000</ev:enddate></ev:gd_event_meta>

    …everything else worked great!

    Thanks!

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Author vaakash

    (@vaakash)

    Hi @aggk,

    Thanks for using Super RSS Reader.

    Right now super rss reader does not recognize metadata like above.

    But by using plugin hooks, we should be able to fetch them.
    https://www.aakashweb.com/docs/super-rss-reader/actions-filters/

    Can you please share the RSS feed you are using ?
    Let me see if I can share the code for you.

    Thanks,
    Aakash

    Plugin Author vaakash

    (@vaakash)

    Please paste below code in function.php and enable “Show date” in feed settings. This will work for both free and PRO.

    It uses Super RSS Reader’s hook to fetch and insert custom data from feed.
    https://www.aakashweb.com/docs/super-rss-reader/actions-filters/

    add_filter( 'srr_mod_item_html', 'srr_show_event_time', 10, 3 );
    
    function srr_show_event_time($data, $feed_url, $item){
        
        $event = $item->get_item_tags( 'Event', 'gd_event_meta' );
        
        if( empty( $event ) ){
            return $data;
        }
        
        $start_date = date_i18n( 'Y/m/d g:i A', SimplePie_Misc::parse_date( $event[0]['child']['Event']['startdate'][0]['data'] ) );
        $end_date = date_i18n( 'Y/m/d g:i A', SimplePie_Misc::parse_date( $event[0]['child']['Event']['enddate'][0]['data'] ) );
        
        $data['meta'] = $start_date . ' - ' . $end_date;
        
        return $data;
        
    }

    Thanks,
    Aakash

    Thread Starter aggk

    (@aggk)

    Thank you so much!

    Retrieving the event dates works great, however I discovered that the “Show Author” option no longer has effect when that snippet is in place?

    Thanks!

    Plugin Author vaakash

    (@vaakash)

    Please try updated code below. You might have to do the following.

    1) Replace <the_feed_url> with the feed URL you are using. This would prevent the hook being applied to all super RSS reader feeds.
    2) Disable “show date” in widget options.

    You can edit the 3rd last line to format the output as you need.

    add_filter( 'srr_mod_item_html', 'srr_show_event_time', 10, 3 );
    
    function srr_show_event_time($data, $feed_url, $item){
        
        if( $feed_url != '<the_feed_url>' ){
            return $data;
        }
        
        $event = $item->get_item_tags( 'Event', 'gd_event_meta' );
        
        if( empty( $event ) ){
            return $data;
        }
        
        $start_date = date_i18n( 'Y/m/d g:i A', SimplePie_Misc::parse_date( $event[0]['child']['Event']['startdate'][0]['data'] ) );
        $end_date = date_i18n( 'Y/m/d g:i A', SimplePie_Misc::parse_date( $event[0]['child']['Event']['enddate'][0]['data'] ) );
        
        $data['meta'] = '<span class="srr-date">' . $start_date . ' - ' . $end_date . '</span>' . $data['meta'];
        
        return $data;
        
    }

    Thanks,
    Aakash

    Thread Starter aggk

    (@aggk)

    Perfect, thank you!

    Plugin Author vaakash

    (@vaakash)

    Cheers !

    Thread Starter aggk

    (@aggk)

    Hi again,

    From what I understand an RSS feed should deliver date/time in GMT/UTC timezone and the “extractor” need to convert to it’s timezone?

    Now I’m retrieving a feed here that comes with GMT/UTC however I need to display with Stockholm timezone (which is set in WordPress settings) could the code above take this into account so that dates are displayed in Stockholm timezone? (right now I believe it displays the GMT/UTC that the RSS feed deliver)

    Thanks!

    Plugin Author vaakash

    (@vaakash)

    Hi @aggk,

    I’ll check and get back to you.

    Thanks

    Thread Starter aggk

    (@aggk)

    Hi,

    I just wanted to follow up if you had a chance to look into this?

    Thanks!

    Plugin Author vaakash

    (@vaakash)

    Hi @aggk,

    Sorry I missed this out. I’ll get back to you by tomorrow.

    Plugin Author vaakash

    (@vaakash)

    Hi @aggk,

    Please replace

        $start_date = date_i18n( 'Y/m/d g:i A', SimplePie_Misc::parse_date( $event[0]['child']['Event']['startdate'][0]['data'] ) );
        $end_date = date_i18n( 'Y/m/d g:i A', SimplePie_Misc::parse_date( $event[0]['child']['Event']['enddate'][0]['data'] ) );

    with this

        $start_date = get_date_from_gmt( date_i18n( 'Y-m-d H:i:s', SimplePie_Misc::parse_date( $event[0]['child']['Event']['startdate'][0]['data'] ) ), 'Y/m/d g:i A' );
        $end_date = get_date_from_gmt( date_i18n( 'Y-m-d H:i:s', SimplePie_Misc::parse_date( $event[0]['child']['Event']['enddate'][0]['data'] ) ), 'Y/m/d g:i A' );

    I didn’t try the code but I hope it should work.
    let me know how it goes.

    Thanks,
    Aakash

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Event date field’ is closed to new replies.