I'm try to use related entries from different channels to display content on a home page. Using the code following with "selectNews" as a entries fieldHandle in the Home Page:
{% set entry = entry.selectNews.first() %}
{% if entry %}
...
{% endif %}
This places field entries from craft section "news", the first & only entry. Following that is a div with the same code, but with a new entries field and fieldHandle, "messageBanner", relating to an channel named "Banners". This second set of code fails to display anything. I see that
... {{ entry }}...
tested in the failed div, outside of {%set entry =... endif %}
, prints to screen the related entry title from the previous code. How can I get this fixed and what am I missing. Pretty confused.
{% set entry = entry.selectNews.first() %}
{% if entry %}
...
<div class="row">
{% set asset = entry.newsImage.first() %}
{% if asset %}
<img class="col-xs-12" src=" {{ asset.url }} " alt=" News image "/>
{% endif %}
</div>
</div>
...
{% endif %}
{% set entry = entry.messageBanner.first() %}
{% if entry %}
<section class="offer-stripe center">
<div class="container-fluid">
<div class="row">
<div class="col-xs-12">
<a href="{{ entry.bannerLink }}">
<h5><span class="red"> some text </span><small><em> {{entry.bannerText}} </em></small></h5></a>
</div>
</div>
</div>
</section>
{% endif %}