将Shopify下拉菜单添加到主题

时间:2018-06-27 20:40:47

标签: html shopify liquid

我需要帮助,将新的子菜单功能添加到网站https://latitudegallery.com.au的主题文件中。

我已经在CMS中添加了子菜单,现在我只需要它们进入我的代码即可。当前是下面的代码。

<!-- snippets/action-bar.liquid -->
{% assign action_bar_main_active = true %}
{% for link in linklists[section.settings.action_bar_link_list].links %}
  {% if link.active or template.name == 'index' or template.name == 'collection' %}
    {% assign child_list_handle = link.title | handleize %}
    {% if linklists[child_list_handle].links == blank and link.active %}
      {% assign action_bar_active_url = link.url %}
    {% endif %}
  {% endif %}
{% endfor %}
  <div class="action-bar-wrapper {% if template.name == 'index' %} action-bar--hero{% endif %} {% if section.settings.action_bar_link_list == blank %} hide {% endif %}" data-section-id="{{ section.id }}" data-section-type="action-bar-section">
    <nav class="action-bar action-bar--has-menu" role="presentation">
      <ul class="action-bar__menu--main action-bar__menu list--inline {% if action_bar_main_active %} action-bar--show{% endif %}" id="SiteNav" role="navigation" style="font-style: normal;">
        {% for link in linklists[section.settings.action_bar_link_list].links %}
          {% assign child_list_handle = link.title | handleize %}
          {% if linklists[child_list_handle].links != blank %}
            {% if child_list_handle == active_child_link_handle %}
              {% assign active_children = true %}
            {% else %}
              {% assign active_children = false %}
            {% endif %}
            <li class="action-bar__menu-item action-bar--has-dropdown{% if link.active or active_children %} action-bar--active{% endif %}{% if active_children %} action-bar--disabled{% endif %}" data-child-list-handle="{{ child_list_handle }}" >
              <a href="{{ link.url }}" class="action-bar__link" aria-controls="{{ child_list_handle | capitalize }}">{{ link.title }}</a>
            </li>
          {% else %}
            <li class="action-bar__menu-item {% if link.active %}action-bar--active{% endif %}">
              <a href="{{ link.url }}" class="action-bar__link">{{ link.title }}</a>
            </li>
          {% endif %}
        {% endfor %}
      </ul>
    </nav>
  </div>

{% schema %}
  {
    "name": "Action bar",
    "class": "action-bar-section",
    "settings": [  {
        "type": "link_list",
        "id": "action_bar_link_list",
        "label": "Menu",
        "default": "main-menu"
      }]
  }
{% endschema %}

0 个答案:

没有答案