I have created a news_list.html page and news.php for news stories and in the admin panel I only have a date published bar...Is there anyway to add to the date published field an end date that when the article or post reaches the end date the article or post unpublishes itself?
To use 'datetime' region you'll need to enable the DataBound Form module first. Do the following to enable it -
Edit the 'kfunctions.php' file found in 'couch/addons' folder and uncomment (or add if upgrading from an older version) the following line
require_once( K_COUCH_DIR.'addons/data-bound-form/data-bound-form.php' );
Now define the following 'expiry_date' region in your template
- Code: Select all
<cms:editable name='expiry_date' type='datetime' format='mdy'/>
Use the regions value in the existing cms:pages listing as follows
<cms:pages custom_field="expiry_date > <cms:date format='Y-m-d H:i:s' />">
...
</cms:pages>
In the code above, the <cms:date format='Y-m-d H:i:s' /> statement always produces the current date. So the code basically evaluates to - show pages that have their expiry-dates beyond the current date.
Hope it helps.