dev-master
9999999-devAuto Expire plugin for Craft CMS
The Requires
- composer/installers ~1.0
- php >=5.3.0
Auto Expire plugin for Craft CMS
This plugin allows to set an entryâs Expiry Date, Post Date or any custom date field automatically on entry save. The date value is generated from a Twig template which can be set up in the plugin settings., (*1)
The plugin is available on Packagist and can be installed using Composer. You can also download the [latest release]0 and copy the files into craft/plugins/autoexpire/., (*2)
$ composer require carlcs/craft-autoexpire
Navigate to the pluginâs settings page and add a new rule to define the conditions for how dates are being set by the plugin., (*3)
Auto Expire uses the same approach to parse a Twig Template from a field as Craftâs Title Format settings field, please see Dynamic Entry Titles in the Craft Documentation for more information about the expected syntax., (*4)
When using tags to output date properties keep in mind that, by default, Twig returns dates in "Y-m-d" format without any time information (which is the same as if you had set it to 12:00 AM)., (*5)
Thatâs why you probably want to use Twigâs date
filter to explicitly define a format containing the time, i.e. date('c')
., (*6)
Examples:, (*7)
Set to a fixed date:, (*8)
2015-05-13 13:00
Set a date based on the entryâs Post Date:, (*9)
{{ object.postDate|date_modify('+7 days')|date('c') }}
or using another relative time format:, (*10)
{{ object.postDate|date_modify('first day of next month 5am')|date('c') }}
More complex example using a conditional (ternary syntax):, (*11)
{{ object.myDateTimeField ? object.myDateTimeField|date('c') : object.postDate|date_modify('+7 days')|date('c') }}
Check this field to allow users to overwrite the automatically set date. In this case the plugin will only set the date if the date field is left blank by the user., (*12)
Auto Expire plugin for Craft CMS