CMS Development

bengoshow
Participante | Parceiro
Participante | Parceiro

Offset starting point in blog post list, exclude first post

resolver

Is there a way using rss_listing or blog_recent_posts to exclude the first X posts?

0 Avaliação positiva
1 Solução aceita
bengoshow
Solução
Participante | Parceiro
Participante | Parceiro

Offset starting point in blog post list, exclude first post

resolver

I figured out how to do it this way, skipping the first post and displaying the next 3:

 

{% set rec_posts = blog_recent_posts('default', 4) %}
{% for content in rec_posts %}
{% if loop.index > 1 %}
<a class="hs-rss-title" href="{{ group.absolute_url }}/{{ content.slug }}"><span>{{ content.name }}</span></a>
{%endif%}
{% endfor %}

 

You can just increase the number if you want to skip more than the first one, ie:

 

{% if loop.index > 2 %}

Exibir solução no post original

2 Respostas 2
simmpaul
Colaborador(a) | Parceiro Diamante
Colaborador(a) | Parceiro Diamante

Offset starting point in blog post list, exclude first post

resolver

[Reply Deleted - Irrelevant]

0 Avaliação positiva
bengoshow
Solução
Participante | Parceiro
Participante | Parceiro

Offset starting point in blog post list, exclude first post

resolver

I figured out how to do it this way, skipping the first post and displaying the next 3:

 

{% set rec_posts = blog_recent_posts('default', 4) %}
{% for content in rec_posts %}
{% if loop.index > 1 %}
<a class="hs-rss-title" href="{{ group.absolute_url }}/{{ content.slug }}"><span>{{ content.name }}</span></a>
{%endif%}
{% endfor %}

 

You can just increase the number if you want to skip more than the first one, ie:

 

{% if loop.index > 2 %}