Skip to main content
replaced http://craftcms.stackexchange.com/ with https://craftcms.stackexchange.com/
Source Link

As you'll only ever be working with one entry I wouldn't bother with the for loop for the first part of your question. Just set a variable with your featured news article. Something like this (not tested though):

{% set featuredArticle = craft.entries.section('news').first() %}

<div class="container" id="featured-news">
    <div class=col-md-6>
        <h2 class="news-title">{{ featuredArticle.title }}</h2>
        <h3 class="news-date">{{ featuredArticle.postDate.format('F d, Y') }}</h3>
        <p>
        {{ featuredArticle.body }}
        </p>
    </div>
    <img class="col-md-4" src="images/pic-block-pic1.jpg" style="float:right;">
    <div class="col-xs-12" >
    <a href="{{ featuredArticle.url }}" style="float:right; padding: 20px 0px 20px 0px">READ FULL STORY...</a>
    </div>
</div>

EDIT: Then for the second part of your question this other answer tells you how to exclude an Entry:

How can I exclude the current entry when I've structured my syntax like this?How can I exclude the current entry when I've structured my syntax like this?

So from the other article, you'd do:

{% set entries = craft.entries({
  section: 'news'
}).id('not ' ~ featuredArticle.id) %}

As you'll only ever be working with one entry I wouldn't bother with the for loop for the first part of your question. Just set a variable with your featured news article. Something like this (not tested though):

{% set featuredArticle = craft.entries.section('news').first() %}

<div class="container" id="featured-news">
    <div class=col-md-6>
        <h2 class="news-title">{{ featuredArticle.title }}</h2>
        <h3 class="news-date">{{ featuredArticle.postDate.format('F d, Y') }}</h3>
        <p>
        {{ featuredArticle.body }}
        </p>
    </div>
    <img class="col-md-4" src="images/pic-block-pic1.jpg" style="float:right;">
    <div class="col-xs-12" >
    <a href="{{ featuredArticle.url }}" style="float:right; padding: 20px 0px 20px 0px">READ FULL STORY...</a>
    </div>
</div>

EDIT: Then for the second part of your question this other answer tells you how to exclude an Entry:

How can I exclude the current entry when I've structured my syntax like this?

So from the other article, you'd do:

{% set entries = craft.entries({
  section: 'news'
}).id('not ' ~ featuredArticle.id) %}

As you'll only ever be working with one entry I wouldn't bother with the for loop for the first part of your question. Just set a variable with your featured news article. Something like this (not tested though):

{% set featuredArticle = craft.entries.section('news').first() %}

<div class="container" id="featured-news">
    <div class=col-md-6>
        <h2 class="news-title">{{ featuredArticle.title }}</h2>
        <h3 class="news-date">{{ featuredArticle.postDate.format('F d, Y') }}</h3>
        <p>
        {{ featuredArticle.body }}
        </p>
    </div>
    <img class="col-md-4" src="images/pic-block-pic1.jpg" style="float:right;">
    <div class="col-xs-12" >
    <a href="{{ featuredArticle.url }}" style="float:right; padding: 20px 0px 20px 0px">READ FULL STORY...</a>
    </div>
</div>

EDIT: Then for the second part of your question this other answer tells you how to exclude an Entry:

How can I exclude the current entry when I've structured my syntax like this?

So from the other article, you'd do:

{% set entries = craft.entries({
  section: 'news'
}).id('not ' ~ featuredArticle.id) %}
Added example from other answer.
Source Link
Steve Holland
  • 2.5k
  • 1
  • 17
  • 31

As you'll only ever be working with one entry I wouldn't bother with the for loop for the first part of your question. Just set a variable with your featured news article. Something like this (not tested though):

{% set featuredArticle = craft.entries.section('news').first() %}

<div class="container" id="featured-news">
    <div class=col-md-6>
        <h2 class="news-title">{{ featuredArticle.title }}</h2>
        <h3 class="news-date">{{ featuredArticle.postDate.format('F d, Y') }}</h3>
        <p>
        {{ featuredArticle.body }}
        </p>
    </div>
    <img class="col-md-4" src="images/pic-block-pic1.jpg" style="float:right;">
    <div class="col-xs-12" >
    <a href="{{ featuredArticle.url }}" style="float:right; padding: 20px 0px 20px 0px">READ FULL STORY...</a>
    </div>
</div>

EDIT: Then for the second part of your question this other answer tells you how to exclude an Entry:

How can I exclude the current entry when I've structured my syntax like this?

So from the other article, you'd do:

{% set entries = craft.entries({
  section: 'news'
}).id('not ' ~ featuredArticle.id) %}

As you'll only ever be working with one entry I wouldn't bother with the for loop for the first part of your question. Just set a variable with your featured news article. Something like this (not tested though):

{% set featuredArticle = craft.entries.section('news').first() %}

<div class="container" id="featured-news">
    <div class=col-md-6>
        <h2 class="news-title">{{ featuredArticle.title }}</h2>
        <h3 class="news-date">{{ featuredArticle.postDate.format('F d, Y') }}</h3>
        <p>
        {{ featuredArticle.body }}
        </p>
    </div>
    <img class="col-md-4" src="images/pic-block-pic1.jpg" style="float:right;">
    <div class="col-xs-12" >
    <a href="{{ featuredArticle.url }}" style="float:right; padding: 20px 0px 20px 0px">READ FULL STORY...</a>
    </div>
</div>

EDIT: Then for the second part of your question this other answer tells you how to exclude an Entry:

How can I exclude the current entry when I've structured my syntax like this?

As you'll only ever be working with one entry I wouldn't bother with the for loop for the first part of your question. Just set a variable with your featured news article. Something like this (not tested though):

{% set featuredArticle = craft.entries.section('news').first() %}

<div class="container" id="featured-news">
    <div class=col-md-6>
        <h2 class="news-title">{{ featuredArticle.title }}</h2>
        <h3 class="news-date">{{ featuredArticle.postDate.format('F d, Y') }}</h3>
        <p>
        {{ featuredArticle.body }}
        </p>
    </div>
    <img class="col-md-4" src="images/pic-block-pic1.jpg" style="float:right;">
    <div class="col-xs-12" >
    <a href="{{ featuredArticle.url }}" style="float:right; padding: 20px 0px 20px 0px">READ FULL STORY...</a>
    </div>
</div>

EDIT: Then for the second part of your question this other answer tells you how to exclude an Entry:

How can I exclude the current entry when I've structured my syntax like this?

So from the other article, you'd do:

{% set entries = craft.entries({
  section: 'news'
}).id('not ' ~ featuredArticle.id) %}
Added more detail.
Source Link
Steve Holland
  • 2.5k
  • 1
  • 17
  • 31

As you'll only ever be working with one entry I wouldn't bother with the for loop for the first part of your question. Just set a variable with your featured news article. Something like this (not tested though):

{% set featuredArticle = craft.entries.section('news').first() %}

<div class="container" id="featured-news">
    <div class=col-md-6>
        <h2 class="news-title">{{ featuredArticle.title }}</h2>
        <h3 class="news-date">{{ featuredArticle.postDate.format('F d, Y') }}</h3>
        <p>
        {{ featuredArticle.body }}
        </p>
    </div>
    <img class="col-md-4" src="images/pic-block-pic1.jpg" style="float:right;">
    <div class="col-xs-12" >
    <a href="{{ featuredArticle.url }}" style="float:right; padding: 20px 0px 20px 0px">READ FULL STORY...</a>
    </div>
</div>

EDIT: Then for the second part of your question this other answer tells you how to exclude an Entry:

How can I exclude the current entry when I've structured my syntax like this?

As you'll only ever be working with one entry I wouldn't bother with the for loop for the first part of your question. Just set a variable with your featured news article. Something like this (not tested though):

{% set featuredArticle = craft.entries.section('news').first() %}

<div class="container" id="featured-news">
    <div class=col-md-6>
        <h2 class="news-title">{{ featuredArticle.title }}</h2>
        <h3 class="news-date">{{ featuredArticle.postDate.format('F d, Y') }}</h3>
        <p>
        {{ featuredArticle.body }}
        </p>
    </div>
    <img class="col-md-4" src="images/pic-block-pic1.jpg" style="float:right;">
    <div class="col-xs-12" >
    <a href="{{ featuredArticle.url }}" style="float:right; padding: 20px 0px 20px 0px">READ FULL STORY...</a>
    </div>
</div>

As you'll only ever be working with one entry I wouldn't bother with the for loop for the first part of your question. Just set a variable with your featured news article. Something like this (not tested though):

{% set featuredArticle = craft.entries.section('news').first() %}

<div class="container" id="featured-news">
    <div class=col-md-6>
        <h2 class="news-title">{{ featuredArticle.title }}</h2>
        <h3 class="news-date">{{ featuredArticle.postDate.format('F d, Y') }}</h3>
        <p>
        {{ featuredArticle.body }}
        </p>
    </div>
    <img class="col-md-4" src="images/pic-block-pic1.jpg" style="float:right;">
    <div class="col-xs-12" >
    <a href="{{ featuredArticle.url }}" style="float:right; padding: 20px 0px 20px 0px">READ FULL STORY...</a>
    </div>
</div>

EDIT: Then for the second part of your question this other answer tells you how to exclude an Entry:

How can I exclude the current entry when I've structured my syntax like this?

Source Link
Steve Holland
  • 2.5k
  • 1
  • 17
  • 31
Loading