How to get latest entries by particular field? I have 4 fields in my section:

-Images

-Videos

-GIFs

-PNGs

On my homepage, I have a section where I have to show 5 latest entries of Images, Videos, GIFs &amp; PNGs. How can I do that ?

I tried:

 {{set entries = craft.entries.section('works').order('fieldname desc').limit(5) }}


But that didn't work. Please Help. Thanks in advance !!
Looks like you're trying to echo out the results using {{ instead of actually setting it using %} tags.

{% set entries = craft.entries.section('works').order('fieldname desc').limit(5) %}

{% for entry in entries %}
   {{ entry.title }}
{% endfor %}


This should fix your problem.