Problems, need help? Have a tip or advice? Post it here.
5 posts Page 1 of 1
Hi, I was wondering if it's possible to automatically archive posts which are past the current date.
I have created a view which lists all my posts date wise. Now, I was looking for a solution to automatically put the old posts in archive and hence prevent them from showing up in the main view.
Thanks in advance.
Hi Richie,

The cms:pages tag that you've used to create the listing supports 'start_on' and 'stop_before' parameters. We can use these to restrict the main listing to show only current pages (and conversely create an 'archive' listing where only older posts are shown).

That said, what you are trying to do will require some more thought - how would you define 'current'? You alluded to 'the current date' - anything past the current date shouldn't show up on the main listing. But then are you sure you post so regularly that there is altleast a new post everyday. Else, there is bound to be a day when no posts will show on the listing as none would be 'current'.

Give it a thought. I think a period of past 30 days or so would be more practical.

Thanks
So, is there a parameter so that i can specify to list posts which are not older than today's date?
for example: i have 4 posts dated 24,25,26,27 April 2014 and today's date is 25th. So, is there a way that i can display posts from today and future? skipping the older posts (24th dated one in this case)
i.e. start_on should point to current date
I mentioned the two parameters above.
Please try the following snippet -
Code: Select all
<cms:set cur_date="<cms:date format='Y-m-d' />" 'global' />

<cms:pages start_on=cur_date show_future_entries='1' >
    ...
</cms:pages>

Does this help?
solved it using the show_future_entries tag.
thanks! :)
5 posts Page 1 of 1