【问题标题】:Shopify don't show certain items in menuShopify 不在菜单中显示某些项目
【发布时间】:2014-02-17 11:13:23
【问题描述】:

这是我的标题菜单的代码:

<ul>
  {% for link in linklists.main-menu.links %}
  <li class="{% if forloop.first %}first{% elsif forloop.last %}last{%endif%}">
    {% assign child_list_handle = link.title | handleize %}
    {% if linklists[child_list_handle].links != blank %}
    <div class="has-dropdown">
      <a href="{{ link.url }}" class="clearfix">
        <span class="nav-label">{{ link.title | escape }}</span>
        <span class="nav-arrow"></span>
      </a>
      <ul>
        {% for childlink in linklists[child_list_handle].links %}
        <li><a href="{{ childlink.url }}">{{ childlink.title | escape }}</a></li>
        {% endfor %}
      </ul>
    </div>
    {% else %}
      <a href="{{ link.url }}">{{ link.title | escape }}</a>
    {% endif %}
  </li>
  {% endfor %}
</ul>

我不确定这是用什么语言编写的,但我想更改它,以便菜单中不显示任何名为“featrued”的项目。 sudo 代码是这样的:

if name!="featured" then {  ...    }...

这是我尝试过的:

{% if link.title != featured %}
...
{% endif %}

谁能帮我了解需要进行哪些调整?

【问题讨论】:

    标签: php templates e-commerce shopify liquid


    【解决方案1】:

    你已经接近了!您只需将链接的标题用引号引起来。

    试试这个:

    <ul>
      {% for link in linklists.main-menu.links %}
        {% if link.title != 'featured' %}
          <li class="{% if forloop.first %}first{% elsif forloop.last %}last{%endif%}">
            ...
          </li>
        {% endif %}
      {% endfor %}
    </ul>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-09-24
      • 1970-01-01
      • 2014-06-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-09-06
      相关资源
      最近更新 更多