Filter Posts By Date
The following examples will show you how to display Posts on the website based on their date.
These examples are useful for a situation where Posts are used to advertise events on the website, and you need to hide the Post after a certain date / time.
To change the Date of a Post, navigate to Dashboard > Website > Posts, click a Post to edit, and select the "additional attributes" tab.
Use an <ss:data:repeater> to retrieve Posts associated with a Post Category, and output the Posts's date and time:
Add an <ss:logic:if> control, to test whether the Post Date is greater than the current date / time:
Extending this, we can slightly alter the <ss:logic:if> test, so that Posts display 24 hours after the Post's Date:
Change the order Posts are displayed
By default, Posts will be ordered by the Post Date in descending order. To reverse this, update the dataorder="" attribute of the
Use datafilter to improve performance
In the situation where you website contains a lot of Posts (noticeable at > 100 Posts), you will see improved performance by using the datafilter="" attribute on the <ss:data:repeater>, which would replace the need for the <ss:logic:if> test:
Use the Post Template Display to finish
Instead of just displaying the Post Title and Date, use the Post Display instead: