<p>I got it by simply adding a condition where I was displaying my previous entry.</p>

<pre><code>{% if prevEntry %}

    {% if prevEntry.comingSoon %}

        {# if comingSoon field is active, hide the link #}

    {% else %}

    &lt;div class="previousProject"&gt;
        &lt;a href="{{ prevEntry.getUrl() }}"&gt;
            &lt;span class="visibleText"&gt;Previous&lt;/span&gt;
            &lt;span class="projectTitle"&gt;{{ prevEntry.client }}&lt;/span&gt;
        &lt;/a&gt;
    &lt;/div&gt;

    {% endif %}
{% endif %}
</code></pre>

CC BY-SA 4.0
2019-06-04T03:21:12.507Z
2019-06-04T03:21:12.507Z
mateostabio
<p>I have projects on my portfolio that link to each other. I'm currently using previous and next links.</p>

<p>This is what my code looks like</p>

<pre><code>{# Set parameters for prev/next elements list #}
{% set params = craft.entries.section('portfolio') %}
{# Get the prev/next elements #}
{% set prevEntry = entry.getPrev(params) %}
{% set nextEntry = entry.getNext(params) %}
</code></pre>

<p>And then I call it to display it in my code like so:</p>

<pre><code>&lt;div class="projectsNavigation"&gt;
    {% if prevEntry %}
    &lt;div class="previousProject"&gt;
        &lt;a href="{{ prevEntry.getUrl() }}"&gt;
            &lt;span class="visibleText"&gt;Previous&lt;/span&gt;
            &lt;span class="projectTitle"&gt;{{ prevEntry.client }}&lt;/span&gt;
        &lt;/a&gt;
    &lt;/div&gt;
    {% endif %}
    {% if nextEntry %}
    &lt;div class="nextProject"&gt;
        &lt;a href="{{ nextEntry.getUrl() }}"&gt;
            &lt;span class="visibleText"&gt;Next Project&lt;/span&gt;
            &lt;span class="projectTitle"&gt;{{ nextEntry.client }}&lt;/span&gt;
        &lt;/a&gt;
    &lt;/div&gt;
    {% endif %}
&lt;/div&gt;
</code></pre>

<p>My goal today is to hide the previous entry button if the previous entry has the <code>comingSoon</code> lightswitch field ON. </p>

<entries><lightswitch><previous-next>
Show/display entries next/prev except entries with lightswitch field active
# Show/display entries next/prev except entries with lightswitch field active

(Asked by: username_0 on 2019-06-04)

I have projects on my portfolio that link to each other. I'm currently using previous and next links.
This is what my code looks like
{# Set parameters for prev/next elements list #}
{% set params = craft.entries.section('portfolio') %}
{# Get the prev/next elements #}
{% set prevEntry = entry.getPrev(params) %}
{% set nextEntry = entry.getNext(params) %}

And then I call it to display it in my code like so:

    {% if prevEntry %}
    
        
            Previous
            {{ prevEntry.client }}
        
    
    {% endif %}
    {% if nextEntry %}
    
        
            Next Project
            {{ nextEntry.client }}
        
    
    {% endif %}


My goal today is to hide the previous entry button if the previous entry has the comingSoon lightswitch field ON.

**Tags:** entries, lightswitch, previous-next


---

## 1 answers

### Answer by username_0 on 2019-06-04. Score: 1

I got it by simply adding a condition where I was displaying my previous entry.
{% if prevEntry %}

    {% if prevEntry.comingSoon %}

        {# if comingSoon field is active, hide the link #}

    {% else %}

    
        
            Previous
            {{ prevEntry.client }}
        
    

    {% endif %}
{% endif %}


---

