<p>Looks like you're trying to echo out the results using <code>{{</code> instead of actually setting it using <code>%}</code> tags.</p>

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

{% for entry in entries %}
   {{ entry.title }}
{% endfor %}
</code></pre>

<p>This should fix your problem.</p>

CC BY-SA 3.0
2017-04-18T13:34:27.733Z
2017-04-18T13:34:27.733Z
Alec Ritson
<p>I have 4 fields in my section:</p>

<p>-Images</p>

<p>-Videos</p>

<p>-GIFs</p>

<p>-PNGs</p>

<p>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 ?</p>

<p>I tried:</p>

<pre><code> {{set entries = craft.entries.section('works').order('fieldname desc').limit(5) }}
</code></pre>

<p>But that didn't work. Please Help. Thanks in advance !!</p>

<ordering>
How to get latest entries by particular field?
# How to get latest entries by particular field?

(Asked by: username_0 on 2017-04-18)

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 & 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 !!

**Tags:** ordering

---

## 1 answers

### Answer by username_1 on 2017-04-18. Score: 2

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.


---

