I'm currently using fetch_feed() to pull in RSS feeds of calendar events that live in an external, non-WP site. Once I pull in those feeds, I display each feed's events in a calendar view.

The problem is, fetch_feed() has you set a number of items to grab. My goal is to show all events for the current month, and every month has a different number of events. So, I can either set the max number of events very high, take a performance hit, and be sure that I am grabbing all of the events, or I can lower the number of events but risk missing some of them toward the end of a month.

Does fetch_feed() or any other RSS parser enable you to fetch RSS items by date rather than by the number of total items to grab? Not just order by date - actually grab however many items have a date within the range I specify? Is there a better way to pull in this data, given that the only somewhat parseable format I can get out of the source site is these RSS feeds - their closed API is not feasible?

  • is the feed you are fetching generated by a wordpress site or not? you may need to add this information to your question, as I don't think this is something you can do just in the way you fetch the feed but actually specify in the requested feed URL. – majick Dec 16 '17 at 2:50
  • No, as stated in the original question, the feed is not generated by WP. – WebElaine Dec 18 '17 at 14:43
  • sorry missed that, can't see a way to do it easily, I'd suggest getting a large amount of events as you said, but caching the results so you aren't fetching the feed every pageload, this would counteract the performance hit. – majick Dec 19 '17 at 0:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.