Skip to content

Commit c34ab0e

Browse files
committed
add blog category filter dropdown snippet
1 parent bdc86ab commit c34ab0e

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ This is a list of useful Shopify Snippets that I often reference while developin
88
* [Add Original Price of Discounted products on Cart Page](#add-original-price-of-discounted-products-on-cart-page)
99
* [Add On Sale Badge on Products Based on Price](#add-on-sale-badge-on-products-based-on-price)
1010
* [Back or Continue Shopping link on Cart](#back-or-continue-shopping-link-on-cart)
11+
* [Blog Category Filter Dropdown](#blog-category-filter-dropdown)
1112
* [Calculate Discount on Products](#calculate-discount-on-products)
1213
* [Call a Product on any page](#call-a-product-on-any-page)
1314
* [Custom Pagination](#custom-pagination)
@@ -74,6 +75,18 @@ Inset the following code inside items loop in cart template.
7475
<a href="{{ cart.items.first.product.collections.first.url }}" title="Continue Shopping">Continue Shopping</a>
7576
```
7677

78+
## Blog Category Filter Dropdown
79+
```html
80+
{% if blog.tags.size > 0 %}
81+
<select id="BlogTagFilter">
82+
<option value="/blogs/{{ blog.handle }}">{{ 'blogs.article.all_topics' | t }}</option>
83+
{% for tag in blog.all_tags %}
84+
<option value="/blogs/{{ blog.handle }}/tagged/{{ tag | handleize }}" {% if current_tags contains tag %}selected{% endif %}>{{ tag }}</option>
85+
{% endfor %}
86+
</select>
87+
{% endif %}
88+
```
89+
7790
## Calculate Discount on Products
7891
```html
7992
{% capture discount %}

0 commit comments

Comments
 (0)