1

I have a news section on a site and would like to limit entries on certain pages to "fresher" content so that it will only show entries that have been entered within the last three months.

In reviewing all the parameters start_on looks like the closest fit but it would have to be dynamic so that it was something like today's date minus 90 days or something like that.

Is anyone familiar with a way to do this?

Thanks.

3

What Derek said. If you are not a fan of PHP in templates, you could use the date and time plugin (free). Used it in the past for what you are describing, in combination with the start_on and stop_before parameters.

The current date can be obtained using:

{current_time format="%Y-%m-%d"}
0
2

I'm no fan of PHP in templates, but that's the simplest solution here. Enable PHP in your template (on input) first.

<?php $from = date('Y-m-d h:i A', strtotime('90 days ago')); ?>   
{exp:channel:entries start_on="<?php echo $from; ?>" ...
2
  • Hi Derek, does "date" equate to today's date?
    – forrest
    Feb 15 '13 at 14:23
  • Here it's just formatting the timestamp created by the strtotime function. Feb 15 '13 at 15:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.