Skip to content

Instantly share code, notes, and snippets.

@odessy
Created November 26, 2018 21:04
Show Gist options
  • Save odessy/ae80683e2297f668ffada3aac186d4fc to your computer and use it in GitHub Desktop.
Save odessy/ae80683e2297f668ffada3aac186d4fc to your computer and use it in GitHub Desktop.
add additional Announcement message
<div class="header__wrapper">
{% if section.settings.header_enable_account or section.settings.header_enable_search or section.settings.header_message != '' %}
<div class="info-bar showMobile">
<div class="wrapper text-center">
{% if shop.customer_accounts_enabled and section.settings.header_enable_account %}
<div class="header-account-link">
<a href="/account"><img src="{{ 'account.svg' | asset_url }}"></a>
</div>
{% endif %}
{% if section.settings.header_message != '' %}
<div class="header-message uppercase{% if section.settings.header_enable_account or section.settings.header_enable_search %} header-message--crowded{% endif %}">
{% if section.settings.header_message_url != blank %}
<a href="{{ section.settings.header_message_url }}">{{ section.settings.header_message | escape }}</a>
{% else %}
{{ section.settings.header_message | escape }}
{% endif %}
</div>
{% endif %}
{% if section.settings.header_message_2 != '' %}
<div class="header-message uppercase{% if section.settings.header_enable_account or section.settings.header_enable_search %} header-message--crowded{% endif %}">
{% if section.settings.header_message_url_2 != blank %}
<a href="{{ section.settings.header_message_url_2 }}">{{ section.settings.header_message_2 | escape }}</a>
{% else %}
{{ section.settings.header_message_2 | escape }}
{% endif %}
</div>
{% endif %}
{% if section.settings.header_enable_search %}
<div class="header-search__wrapper">
<div class="header-search">
<form action="/search" method="get" class="input-group search" role="search">
{% if section.settings.search_only_products %}<input type="hidden" name="type" value="product">{% endif %}
<input class="search-bar" type="search" name="q">
<button type="submit" class="btn search-btn"></button>
</form>
</div>
</div>
{% endif %}
</div>
</div>
{% endif %}
<header class="site-header {{ section.settings.height }}" role="banner">
<div class="wrapper">
<div class="nav--desktop">
{% include 'nav-contents' with 'desktop' %}
</div>
<div class="nav--mobile">
{% include 'nav-contents' with 'mobile' %}
</div>
</div>
</header>
</div>
{% schema %}
{
"name": "Header",
"settings": [
{
"type": "image_picker",
"id": "logo",
"label": "Logo image"
},
{
"type": "range",
"id": "logo_max_limit",
"min": 5,
"max": 495,
"step": 5,
"unit": "px",
"label": "Custom logo width",
"default": 250
},
{
"type": "link_list",
"label": "Menu",
"id": "main_menu_linklist"
},
{
"type": "select",
"label": "Height",
"id": "height",
"default": "header--medium",
"options": [
{ "value": "header--small", "label": "Small"},
{ "value": "header--medium", "label": "Medium"},
{ "value": "header--large", "label": "Large"},
{ "value": "header--xl", "label": "Extra Large"}
]
},
{
"type": "header",
"content": "Meganav image"
},
{
"type": "image_picker",
"id": "meganav_image",
"label": "Meganav image",
"info": "500 x 800px .jpg max"
},
{
"type": "url",
"id": "meganav_link",
"label": "Meganav Image Link"
},
{
"type": "header",
"content": "Top Bar"
},
{
"type": "text",
"id": "header_message",
"label": "Announcement text",
"info": "45 characters or less recommended"
},
{
"type": "url",
"id": "header_message_url",
"label": "Announcement link"
},
{
"type": "text",
"id": "header_message_2",
"label": "Announcement text 2",
"info": "45 characters or less recommended"
},
{
"type": "url",
"id": "header_message_url_2",
"label": "Announcement link 2"
},
{
"type": "checkbox",
"id": "header_enable_account",
"default": true,
"label": "Show account link in header"
},
{
"type": "checkbox",
"id": "header_enable_search",
"default": true,
"label": "Show search in header"
},
{
"type": "checkbox",
"id": "search_only_products",
"label": "Only search products"
}
]
}
{% endschema %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment