Not sure if what I am looking is possible, but basically I have a section ('portfolio'). At the bottom of each entry I have links to the previous and next entry. Simple.
My trouble is that the body field in my entries is not always populated, and because of this I would like to by-pass these ones in my nav at the bottom of an entry page.
See my code below which is not working, I have a feeling that my logic is not going in the right direction at all with this...
{% set params = craft.entries.section('portfolio') %}
{% set prevEntry = entry.getPrev(params) %}
{% set nextEntry = entry.getNext(params) %}
{% if prevEntry and prevEntry.body | length %}
{% set image = prevEntry.portfolioImages.first() %}
<a href="{{ prevEntry.url }}">Previous</a>
{% endif %}
{% if nextEntry and nextEntry.body | length %}
{% set image = nextEntry.portfolioImages.first() %}
<a href="{{ nextEntry.url }}">Next</a>
{% endif %}