Created
April 18, 2018 13:47
-
-
Save dav11d/69bfff5bb998856fdc6aef16f1d530ab to your computer and use it in GitHub Desktop.
Shopify Sidebar Tag Filter
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% assign all_filter_tags = '' %} | |
{% for link in linklists[filter-by-tag].links %} | |
{% if collection.all_tags contains link.title %} | |
{% capture all_filter_tags %}{{ all_filter_tags }},{{ link.title }}{% endcapture %} | |
{% endif %} | |
{% endfor %} | |
{% assign new_tags = '' %} | |
{% for tag in current_tags %} | |
{% capture new_tags %}{{ new_tags }}+{{ tag | handle }}{% endcapture %} | |
{% endfor %} | |
{% capture new_tags %}{{ new_tags | remove_first: '+' }}{% endcapture %} | |
{% for link in linklists[filter-by-tag].links %} | |
{% if collection.tags contains link.title %} | |
{% if current_tags contains link.title %} | |
<li>{{ link.title | link_to_remove_tag: link.title }}</li> | |
{% else %} | |
{% if collection.url != '' %} | |
{% capture url %}{{ collection.url }}/{% if new_tags != '' %}{{ new_tags }}+{% endif %}{{ link.title | handle }}{% endcapture %} | |
{% else %} | |
{% capture url %}/collections/all/{% if new_tags != '' %}{{ new_tags }}+{% endif %}{{ link.title | handle }}{% endcapture %} | |
{% endif %} | |
<li>{{ link.title | link_to: url }}</li> | |
{% endif %} | |
{% endif %} | |
{% endfor %} | |
{% if collection.url != '' %} | |
{% capture url %}{{ collection.url }}{% if new_tags != '' %}/{{ new_tags }}{% endif %}{% endcapture %} | |
{% else %} | |
{% capture url %}/collections/all{% if new_tags != '' %}/{{ new_tags }}{% endif %}{% endcapture %} | |
{% endif %} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "Collection Filters", | |
"settings": [ | |
{ | |
"type": "paragraph", | |
"content": "Seasonal Collection Filters" | |
}, | |
{ | |
"type": "checkbox", | |
"id": "seasonal_filter_no_1_enable", | |
"label": "Use filter 1?" | |
}, | |
{ | |
"type": "text", | |
"id": "seasonal_filter_no_1_label", | |
"label": "Filter 1 Label" | |
}, | |
{ | |
"type": "link_list", | |
"id": "seasonal_filter_no_1_linklist", | |
"label": "Filter 1 Linklist" | |
}, | |
{ | |
"type": "checkbox", | |
"id": "seasonal_filter_no_2_enable", | |
"label": "Use filter 2?" | |
}, | |
{ | |
"type": "text", | |
"id": "seasonal_filter_no_2_label", | |
"label": "Filter 2 Label" | |
}, | |
{ | |
"type": "link_list", | |
"id": "seasonal_filter_no_2_linklist", | |
"label": "Filter 2 Linklist" | |
}, | |
{ | |
"type": "checkbox", | |
"id": "seasonal_filter_no_3_enable", | |
"label": "Use filter 3?" | |
}, | |
{ | |
"type": "text", | |
"id": "seasonal_filter_no_3_label", | |
"label": "Filter 3 Label" | |
}, | |
{ | |
"type": "link_list", | |
"id": "seasonal_filter_no_3_linklist", | |
"label": "Filter 3 Linklist" | |
}, | |
{ | |
"type": "checkbox", | |
"id": "seasonal_filter_no_4_enable", | |
"label": "Use filter 4?" | |
}, | |
{ | |
"type": "text", | |
"id": "seasonal_filter_no_4_label", | |
"label": "Filter 4 Label" | |
}, | |
{ | |
"type": "link_list", | |
"id": "seasonal_filter_no_4_linklist", | |
"label": "Filter 4 Linklist" | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment