Project

General

Profile

Actions

Support #6071

closed

Tribe Calendar Events feed should be sortable by post date rather than event date

Added by Stephen Klein almost 8 years ago. Updated about 7 years ago.

Status:
Resolved
Priority name:
Normal
Assignee:
Category name:
WordPress Plugins
Target version:
Start date:
2016-09-22
Due date:
% Done:

0%

Estimated time:
Deployment actions:

Description

The GC Library blog uses the Modern Tribe Events Calendar.

We desire to broadscast events from our blog via RSS, but when I insert the Events feed:
http://gclibrary.commons.gc.cuny.edu/events/feed/
and add to the Widget here:
http://ldv1.gc.cuny.edu/~sklein/libtest/
Look under Events (roght sidebar):
It shows the events starting from the earliest rather than latest:

How do I manipulate the feed to show the reverse order?

Note: when I at:
http://gclibrary.commons.gc.cuny.edu/events/feed/
the XML is in the correct order where the latest post is on top.

I know that this is not a theme issue, because our newsfeed (on the left side) is displaying correctly.

Actions #1

Updated by Matt Gold almost 8 years ago

  • Status changed from New to Assigned
  • Assignee set to Boone Gorges
Actions #2

Updated by Boone Gorges almost 8 years ago

  • Status changed from Assigned to Reporter Feedback

Stephen, can you clarify something? You said that http://gclibrary.commons.gc.cuny.edu/events/feed/ shows the "latest post at the top", but that's not what I see when I look at the feed. If I had to guess, I'd say that this feed shows future events, in ascending chronological order. This seems like the "correct" order for event feeds. Am I understanding it correctly?

Can you clarify how this is different from what you're seeing on http://ldv1.gc.cuny.edu/~sklein/libtest/? You say that this widget is showing the earliest events first, but it looks to me like the first event is the furthest one in the future. This suggests that the widget is showing "newest" posts first (though what counts as "newest" is not clear when we talk about the future).

Actions #3

Updated by Stephen Klein almost 8 years ago

I meant that the XML appears to be correct, but when feed is placed in widget the order is reversed and the oldest, then penultimate oldest, etc. display rather than newest/latest.

So this posting:
http://gclibrary.commons.gc.cuny.edu/event/graphic-activism-panel-lesbian-posters-zines-1970-today/
Should not appear here:
http://ldv1.gc.cuny.edu/~sklein/libtest/
but this posting:
http://gclibrary.commons.gc.cuny.edu/event/introduction-pressforward-afternoon/
Should appear instead here:
http://ldv1.gc.cuny.edu/~sklein/libtest/

Makes sense?

Actions #4

Updated by Boone Gorges almost 8 years ago

Yes, I think it makes sense. But if the RSS feed is appearing in the correct order, then I'm not sure that this is a Commons issue, but is instead related to whatever tool you're using to build the widget on your website. It appears to be WordPress. Is it WordPress's default RSS widget?

Actions #5

Updated by Stephen Klein almost 8 years ago

Yes, the default WP RSS widget?

Also, as noted previously, works correctly in the general newsfeed on the left.
Something about the events's RSS?

Actions #6

Updated by Boone Gorges almost 8 years ago

What I'm seeing on http://ldv1.gc.cuny.edu/~sklein/libtest/ is the following three links:

http://gclibrary.commons.gc.cuny.edu/event/graphic-activism-panel-lesbian-posters-zines-1970-today/
http://gclibrary.commons.gc.cuny.edu/event/research-mals-students-reprise/
http://gclibrary.commons.gc.cuny.edu/event/radical-keywords-reference-librarianship/

If I'm reading them correctly, they are the three events with the latest post dates, listed in reverse chronological order.

This is in line with the way the RSS widget works. It shows the "latest" posts from a feed. Usually, RSS feed items have dates in the past. That means that the widget will show the most recent posts. But because your items are dated in the future, the widget is showing the three items that have the latest timestamps. So, as I understand it, the widget and the feed are both working as expected.

Perhaps what you are looking for is a way to take an RSS feed and display future items from that feed, in ascending chronological order. So the first item will be the first one after right now. I don't believe the WordPress RSS widget is built to do this. Perhaps there's another one in the wordpress.org repository that will do it.

Actions #7

Updated by Stephen Klein almost 8 years ago

Just to be clear, what I am saying is I would like, similar to all RSS feeds, last posted item to appear in first/on top of an RSS widget.

Actions #8

Updated by Boone Gorges almost 8 years ago

  • Status changed from Reporter Feedback to Assigned

If "last posted" means the "last item that the editor published" - without any regard for the event date - then it appears that what you're asking is not possible by default. It looks like The Events Calendar filters the post_date for events to match the event's start date, regardless of context: https://github.com/moderntribe/the-events-calendar/blob/3dfa09156c9a960eb88579101526040b89c0bce9/src/Tribe/Templates.php#L83 https://github.com/moderntribe/the-events-calendar/blob/3dfa09156c9a960eb88579101526040b89c0bce9/src/Tribe/Templates.php#L673 So the post_date is not really accessible anywhere in the interface, including in RSS feeds.

It might be possible to override this in the context of feeds, but I don't think it would be good to do globally on the Commons - it could result in unexpected behavior for people currently relying on the feed.

Let me talk to the dev team to see what should be done.

Actions #9

Updated by Boone Gorges almost 8 years ago

  • Subject changed from RSS Feed from Events not broadcasting correctly to Tribe Calendar Events feed should be sortable by post date rather than event date
  • Status changed from Assigned to Reporter Feedback
  • Target version set to 1.9.29

I've updated the title of this ticket to be a more accurate description of the request.

Stephen, I've added some modifcations to the Commons that allow you to override the default behavior of feeds generated by The Events Calendar. http://gclibrary.commons.gc.cuny.edu/events/feed/ will continue to display items by start date. http://gclibrary.commons.gc.cuny.edu/events/feed/?orderby=post_date&order=desc will display items in descending chronological order, by post date. In your RSS widget, replace the URL with http://gclibrary.commons.gc.cuny.edu/events/feed/?orderby=post_date&order=desc and see if it shows what you're hoping for.

Actions #11

Updated by Stephen Klein almost 8 years ago

Thanks for your patience, support and quick turnaround.

Actions #12

Updated by Boone Gorges almost 8 years ago

  • Category name set to WordPress Plugins
  • Status changed from Reporter Feedback to Resolved

Glad to help, Stephen.

Actions #13

Updated by Stephen Klein almost 8 years ago

Is there a way to extract and include the event date in the RSS?
If not, we will just start making it part of the title of each event.

Thanks so much.

Actions #14

Updated by Boone Gorges almost 8 years ago

I've just added a modification to the Commons so that the event start date is now included in the Events feed. See http://gclibrary.commons.gc.cuny.edu/events/feed/?orderby=post_date&order=desc - the element is <cunyAcademicCommons:eventStart>.

I don't think there's a way to modify the default WordPress feed to show additional fields like this. You can do it by implementing your own version of the widget (and, critically, the WP function wp_widget_rss_output()), and getting the additional item element like this: $event_start = $item->get_item_tags( 'cunyAcademicCommons', 'eventDate' );

Putting the event date into the event title is a low-fi way to accomplish what you're looking to do.

Actions #15

Updated by Stephen Klein almost 8 years ago

Thanks, Boone. Appreciate.

Actions #16

Updated by Stephen Klein almost 8 years ago

Seems like it is broken now.

http://ldv1.gc.cuny.edu/~sklein/libtest/

See the widget:
RSS Error: This XML document is invalid, likely due to invalid characters. XML error: Unknown at line 193, column 1

Actions #17

Updated by Boone Gorges almost 8 years ago

I was not seeing the same error as you, but I did see that the feed was not passing validation due to the incorrect declaration of a custom namespace. This should now be fixed (and the Events widget at http://ldv1.gc.cuny.edu/~sklein/libtest/ appears to be displaying items).

Actions #18

Updated by Stephen Klein almost 8 years ago

Thank you.

Actions #19

Updated by Stephen Klein over 7 years ago

Please see:
http://ldv1.gc.cuny.edu/~sklein/libtest/

Generating this error:
An error has occurred, which probably means the feed is down. Try again later.

Using:
http://gclibrary.commons.gc.cuny.edu/events/feed/?orderby=post_date&order=desc

Actions #20

Updated by Boone Gorges over 7 years ago

Stephen - the feed of upcoming events is empty, and the widget that you're using to display the feed items apparently doesn't handle this fact very gracefully.

Actions #21

Updated by Stephen Klein over 7 years ago

Thanks, Boone. We will create a few fake stub entries so that the fees is always populated. I will play and get back to you. Thank you.

Actions #22

Updated by Stephen Klein over 7 years ago

The fake ones show a feed, but not sure if optimal, because they show dates for non-existent events:
https://gclibrary.commons.gc.cuny.edu/event/our-library-calendar/
https://gclibrary.commons.gc.cuny.edu/event/library-events-feed/

Would love to either have the option to redirect for these specific URLs to possibly http://library.gc.cuny.edu
but since I do not have access to .htaccess on the Commons or the header of the HTML, I am unsure how to redirect.

Or to have the option to have a different type of post in the Events plugin that allows for the display of non-event orientated postings, but populates the feed.

If neither of these are viable, do you have a suggestion?

Thank you!

Actions #23

Updated by Boone Gorges over 7 years ago

It's possible to request a feed that includes more than one post type. Here's a feed that includes both upcoming events and past posts: https://gclibrary.commons.gc.cuny.edu/feed/?post_type[]=tribe_events&post_type[]=post&orderby=post_date&order=desc I'm not certain whether this suits your needs.

If you want to redirect a specific page to a URL, activate the Redirection plugin, already available on the Commons.

Actions #24

Updated by Stephen Klein over 7 years ago

great. I will share with the group. Thank you.

Actions #25

Updated by Stephen Klein about 7 years ago

I installed the Events plugin on another site and curious how to construct the RSS URL?

http://ldv1.gc.cuny.edu/~sklein/blog/events/feed/?orderby=post_date&order=desc
is invalid.
so is:
http://ldv1.gc.cuny.edu/~sklein/blog/events/feed/
http://ldv1.gc.cuny.edu/~sklein/blog/events/rss

Although, not hosted on the Commons, can you help?

Thanks,
Stephen

Actions #26

Updated by Boone Gorges about 7 years ago

Hi Stephen - orderby=post_date for RSS feeds is only available on the Commons, thanks to a customization that I wrote. I'm unable to support the use of this customization outside the Commons, but here it is if you want to play with it: https://gist.github.com/boonebgorges/5b5d6090684b2741c4ded0cca2a629b1

I'm not sure why http://ldv1.gc.cuny.edu/~sklein/blog/events/feed/ is not working. Perhaps you have to refresh your Permalinks? I'd recommend reaching out to Tribe for support.

Actions #27

Updated by Stephen Klein about 7 years ago

Yes, it was a permalink issue. Thank you.

Actions

Also available in: Atom PDF