Docs    Facebook

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

Installation

Extensions are installed just like any other WordPress plugin. You can follow the same process used when uploading and installing the Custom Facebook Feed Pro plugin.

Plugin Version 4.0 and above

After installing and enabling the Date Range extension, you will be able to filter your feed to only show posts or events from within a determined date range.

If you set a ‘To’ date but don’t set a ‘From’ date then it will display posts from today’s date until the date you set.
If you set a ‘From’ date but don’t set a ‘To’ date then it will display posts from the date you set until today’s date.
If you don’t set either then the date range won’t be applied.

To enable the Date Range, go to the Edit settings for the feed you want to apply the filter for. Go to Edit > Settings > Filters. Here, enable Show posts within the date range and select your From date and To date.

Date range option enabled

Relative/Moving Dates

The extension also allows you to display posts from relative/moving dates. For example, you could display all posts from the past day by instead selecting the Relative Dates option in the same settings screen. Below are some examples of this.

Posts from the last 2 weeks: from: “-2 weeks” to: “now”

Posts from the past month: from: “-1 month” to: “now”

Posts from the last 12 hours: from: “-12 hours” to: “now”

Posts from the last 24 hours to the last 12 hours: from: “-1 day” to: “-12 hours”

Future Event Ranges

You can also show upcoming events from a specific date range, for example, in the filter settings for an events feed, to show the events for the coming 2 weeks use:

from: “now” until: “+2 weeks”

Relative Date Options

Option Description Example
-x minutes
-x hours
-x days
-x weeks
-x months
The number of minutes ago
The number of hours ago
The number of days ago
The number of weeks ago
The number of months ago
from=”-15 minutes”
from=”-1 hour”
from=”-2 days”
from=”-3 weeks”
from=”-1 month”
now
-x minutes
-x hours
-x days
-x weeks
-x months
Display posts up until now
The number of minutes ago
The number of hours ago
The number of days ago
The number of weeks ago
The number of months ago
until=”now”
until=”-15 minutes”
until=”-1 hour”
until=”-2 days”
until=”-3 weeks”
until=”-1 month”

Below Plugin Version 4.0

Settings Page

Once activated the extension will allow you to set a ‘From’ and ‘Until’ date range to allow you to show posts or events only from between those specific dates.

If you set an ‘Until’ date but don’t set a ‘From’ date then it will display posts from today’s date until the date you set.
If you set a ‘From’ date but don’t set an ‘Until’ date then it will display posts from the date you set until today’s date.
If you don’t set either then the date range won’t be applied.

date-range-screenshot

Shortcode

The Date Range extension also allows you to specify a date range directly in your shortcode like so:

[custom-facebook-feed from="mm/dd/yy" until="mm/dd/yy"]

This then allows you to create separate feeds of posts or events by month like so:

February
[custom-facebook-feed type=events from="02/01/14" until="03/01/14"]

March
[custom-facebook-feed type=events from="03/01/14" until="04/01/14"]

April
[custom-facebook-feed type=events from="04/01/14" until="05/01/14"]

Relative/Moving Dates

The extension also allows you to display posts from relative/moving dates. For example, you could display all posts from the past day by using the following shortcode:

[custom-facebook-feed from="-1 day" until="now"]

Relative dates can only be set via the shortcode and not on the plugin’s Settings page. Below are some other shortcode examples.

Posts from the past two weeks: [custom-facebook-feed from="-2 weeks" until="now"]

Posts from the past month: [custom-facebook-feed from="-1 month" until="now"]

Posts from the last 12 hours: [custom-facebook-feed from="-12 hours" until="now"]

Posts from the last 24 hours to the last 12 hours: [custom-facebook-feed from="-1 day" until="-12 hours"]

Future Event Ranges

You can also show upcoming events from a specific date range, for example to show all events for the coming 2 weeks use:

[custom-facebook-feed type=events eventsource=eventspage from="now" until="+2 weeks"]

Shortcode Options

Name Attribute Options Description Example
From from mm/dd/yy
-x minutes
-x hours
-x days
-x weeks
-x months
The date to display posts from
The number of minutes ago
The number of hours ago
The number of days ago
The number of weeks ago
The number of months ago
from=”02/15/14″
from=”-15 minutes”
from=”-1 hour”
from=”-2 days”
from=”-3 weeks”
from=”-1 month”
Until until mm/dd/yy
now
-x minutes
-x hours
-x days
-x weeks
-x months
The date to display posts until
Display posts up until now
The number of minutes ago
The number of hours ago
The number of days ago
The number of weeks ago
The number of months ago
until=”02/20/14″
until=”now”
until=”-15 minutes”
until=”-1 hour”
until=”-2 days”
until=”-3 weeks”
until=”-1 month”

support

Couldn’t find your answer in the docs?

Contact Support

Was this article helpful?