Show 1 post from a specific tag

SOLVE
Highlighted
New Contributor

I'm trying to simply display the most recent post in the specific tag "branding". I'm using the following but get nothing returned.

 

{% set tag_posts = blog_recent_tag_posts('default', branding, 1) %}
{% for tag_post in tag_posts %}
<div class="post-title">{{ tag_post.name }}</div>
{% endfor %}

0 Upvotes
1 Accepted solution

Accepted Solutions
Highlighted
Solution
New Contributor

I got this to work:

 

<h4>Branding</h4>
{% set brands = blog_recent_topic_posts('default', 'branding', 1) %}
{% for brand in brands %}
<div class="row">
<div class="col-sm-4">
<img src="{{ brand.featured_image }}" alt="{{ brand.name }}">
</div>
<div class="col-sm-8">
<h3><a href="{{ brand.absolute_url }}">{{ brand.name }}</a></h3>
<p>{{ brand.post_summary|striptags|truncate(160, breakword=False, end='...') }}</p>
<a href="{{ brand.absolute_url }}">Read More</a> </li>
{% endfor %}
</div>
</div>

 

This includes my extra markup. Looks like I was needing to use blog_recent_topic_posts instead.

View solution in original post

2 Replies 2
Highlighted
Solution
New Contributor

I got this to work:

 

<h4>Branding</h4>
{% set brands = blog_recent_topic_posts('default', 'branding', 1) %}
{% for brand in brands %}
<div class="row">
<div class="col-sm-4">
<img src="{{ brand.featured_image }}" alt="{{ brand.name }}">
</div>
<div class="col-sm-8">
<h3><a href="{{ brand.absolute_url }}">{{ brand.name }}</a></h3>
<p>{{ brand.post_summary|striptags|truncate(160, breakword=False, end='...') }}</p>
<a href="{{ brand.absolute_url }}">Read More</a> </li>
{% endfor %}
</div>
</div>

 

This includes my extra markup. Looks like I was needing to use blog_recent_topic_posts instead.

View solution in original post

Highlighted
Community Manager

Thank you for sharing this @toddlyda 🙂



¿Sabías que la Comunidad está disponible en Español?
¡Participa hoy en conversaciones en el idioma de tu preferencia,cambiando el idioma en tus configuraciones!

Did you know that the Community is available in other languages?
Join regional conversations by changing your language settings !


0 Upvotes