I would like to display the date that the site was last updated. This date is the same as the last entry added to a specific category. Thanks in advance.
You can order entries by dateUpdated
in descending order and then get the first entry. You would use that entries dateUpdated
field to show when the site was last updated.
{% set entry = craft.entries.order( 'dateUpdated desc' ).first() %}
{{ entry.dateUpdated }}
-
As a side note to this answer when I needed to do this I had to change order to: .order('elements.dateUpdated desc') – John Moylan May 24 '16 at 22:11