Docs    Facebook    Documentation

How to use the Date Range extension to display Facebook posts from a specific date period

How to install the Date Range extension and use it to show Facebook posts from a specific period only.

Would you like to show only the Facebook posts or events from a certain period in your WordPress feed?

In this guide, we’ll show you how to use the Date Range extension to set a start and end date for a feed. We’ll also cover relative dates that move with the calendar, upcoming events, and the events from the next 30 days.

Requirements: The date range settings come from the Date Range extension. The extension is a separate plugin that must be installed and activated next to Custom Facebook Feed Pro.

Before you get started, Custom Facebook Feed Pro must be installed and activated on your WordPress site. You install the extension the same way as any other WordPress plugin.

Here is what we will cover.

Turning On the Date Range Extension

To get started, we’ll turn on the extension in your plugin.

  1. First, install and activate the extension plugin on your site.
  2. Next, from your WordPress admin sidebar, go to Facebook Feed » Extensions.
  3. Then find the Date Range card. If it says Activate, click Activate.
The Date Range card on the Facebook Feed Extensions page with an arrow pointing at the Activate button

If the card shows an Add link instead of Installed, the extension plugin isn’t on your site yet. The link opens the extension page in a new tab.

Once the extension is active, the card shows Deactivate where Activate was. You can now set a date range on any feed.

Setting a Date Range

From your WordPress admin sidebar, go to Facebook Feed » All Feeds. Then open the feed you want to filter.

The All Feeds page of the Facebook Feed plugin with an arrow pointing at the name of a feed
  1. Next, click the Settings tab. Then click Filters.
  2. Then turn on Show posts within the date range.
  3. Under From, choose Specific to pick a fixed date from a calendar. Choose Relative instead to type a moving date, such as “-2 weeks”.
  4. Under To, choose Specific or Relative in the same way. Then enter the end of the range. The Show posts within the date range setting turned on, with Relative chosen under From and To and the values -2 weeks and now entered
  5. Finally, click Save in the top right.

The feed now shows only the posts from that period. If you want a period that moves along with today’s date, read the next section.

Using Relative Dates

Relative dates are based on the current date. This means the period moves on its own. For example, a feed that always shows the last two weeks needs no changes later. The plugin reads each value with strtotime, the standard PHP function that turns text such as “-2 weeks” into a date. The What are relative Dates? tooltip in the settings also lists a few examples, such as “-3 months”.

With Relative selected, the From and To boxes read values like the ones below. The plugin shows the placeholders “eg: -1 days” under From and “eg: now” under To.

ValueWhat it means
-15 minutes15 minutes ago
-1 hourOne hour ago
-2 daysTwo days ago
-3 weeksThree weeks ago
-1 monthOne month ago
nowThe current time
+2 weeksTwo weeks from now

Here are some common combinations.

  • Posts from the last two weeks. From “-2 weeks” and To “now”.
  • Posts from the past month. From “-1 month” and To “now”.
  • Posts from the last 12 hours. From “-12 hours” and To “now”.
  • Posts from between one day ago and 12 hours ago. From “-1 day” and To “-12 hours”.

Relative dates can also point to the future, as the next section shows.

Showing Upcoming Events

You can also set a date range on an Events feed. The plugin adds your From and To dates to the events request in the same way as for posts. From your WordPress admin sidebar, go to Facebook Feed » All Feeds. Then open your Events feed.

  1. Next, click the Settings tab. Then click Filters.
  2. Then turn on Show posts within the date range.
  3. Under From, choose Relative and enter “now”.
  4. Under To, choose Relative and enter “+2 weeks”.
  5. Finally, click Save in the top right.

For the next 30 days, use the steps in the next section.

Showing Events From the Next 30 Days

You don’t need custom code to set a 30-day range on an Events feed. Two relative dates are enough.

  1. From your WordPress admin sidebar, go to Facebook Feed » All Feeds. Then open your Events feed.
  2. Next, click the Settings tab. Then click Filters.
  3. Then turn on Show posts within the date range.
  4. Under From, choose Relative and enter “now”.
  5. Under To, choose Relative and enter “+30 days”.
  6. Finally, click Save in the top right.

That’s it! You now know how to limit a feed to a date range, from fixed dates to relative ones. To learn how to place the feed on your site, read our guide on displaying your Facebook feed on a page, post or widget.

Frequently Asked Questions

Below, we’ve answered some of the most common questions about the Date Range extension.

Why are the date range settings dimmed?

The date range settings are dimmed while the Date Range extension isn’t installed and activated. If the Date Range card under Facebook Feed » Extensions shows Activate, click it. If it shows Add, the extension plugin isn’t installed yet.

What is the difference between Specific and Relative dates?

A specific date is a fixed day that you pick from a calendar. A relative date is based on the current date. This means it moves each day. For example, “-1 days” means one day before today.

Can I set a date range on photo, video or album feeds?

Yes. The plugin adds your date range to the requests for timeline posts, photos, videos, albums and events. Set it in the same Filters section of the feed’s Settings tab.

support

Couldn’t find your answer in the docs?

Contact Support