Posted on by

Showing results from a dynamic timeframe in Participants Database

It’s possible to determine what records are shown using the [pdb_list] shortcode by using the “filter” attribute. If you want to show records from a range of dates, you can use the filter to determine the start and end dates for the range.

List filters are discussed in detail here. Read that page if you have not worked with list filters before.

But what if you want to show a dynamic range of dates? For instance all the records from the last week or all the records from the current month? This is possible by dynamically building the shortcode instead of using it as static text in your content.

Since this requires PHP, there are a couple of ways to go. If you’re familiar with using templates or creating shortcodes, you can do it that way. Another less technical approach is to use a plugin that lets you put PHP code in your content. However you go, you will need to know some simple PHP to customize this for whatever you want to do in your case.

Here is an example of showing all the records from the last week:

And here is an example of getting all the results in the current month:

These are good examples of how to do simple date manipulations using PHP.

Leave a Reply
You have to agree to the comment policy.

Leave a Reply
You have to agree to the comment policy.