所以我当前正在输出一些帖子,但是我只想在使用horizontal-post
类的任何帖子上显示一个按钮,但我似乎无法正常工作。
我在每个帖子的类上循环,但是我只想显示一些使用horizontal-post
的内容。
这是我到目前为止所拥有的:
<section class="posts-grid">
{% set rec_posts = blog_recent_posts('default', 6) %}
{% for rec_post in rec_posts %}
<article class="{% cycle 'post','post','post horizontal-post','post long-post','post','post' %}">
{% if rec_post.post_list_summary_featured_image %}
<img src="{{ rec_post.post_list_summary_featured_image }}" alt="{{ rec_post.featured_image_alt_text }}">
{% endif %}
<div class="blog-listing-info">
<a href="{{ rec_post.absolute_url }}">
<h2 class="blog-listing-title">
{{ rec_post.name }}
</h2>
</a>
<!-- WIP -->
{% if 'horizontal-post' %}
<a href="{{ rec_post.absolute_url }}" class="btn btn-white read-article-btn">Read article</a>
{% else %}
<p class="blog-listing-tag">
{% if rec_post.topic_list %}
{% for topic in rec_post.topic_list %}
<a href="{{ blog_tag_url(group.id, topic.slug) }}" class="topic-name">{{ topic.name }}</a>{% if not loop.last %},{% endif %}
{% endfor %}
{% endif %}
-
{% set initialPostWords = rec_post.post_body|wordcount %}
{% set calculatedPostWords = (initialPostWords/100) * 100 %}
{% set finishedPostWords = calculatedPostWords|divide(300)|round(2) %}
{% set number = finishedPostWords|round %}
{% if number < 1 %}
{% else %}
{{ finishedPostWords|round }} minute read
{% endif %}
</p>
{% endif %}
<!-- end WIP -->
</div>
</article>
{% endfor %}
</section>
感谢您的帮助。