Hubl если кнопка отображения класса цикла - PullRequest
0 голосов
/ 22 декабря 2018

Так что в настоящее время я выводлю некоторые сообщения, но я хочу, чтобы кнопка отображалась в любом сообщении, используя класс 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>

Любая помощь приветствуется.

...