Skip to content

Instantly share code, notes, and snippets.

@bmodena
bmodena / shopify-remove-relatedtags.liquid
Last active July 22, 2016 14:40
Exclude tags from collection.liquid filter when using tags to show related prodcuts
{% comment %}
Based on using Tags to show related products.
Credit : http://twigs.club/library/hand-picked-related-products-using-tags-or-metafields
{% endcomment %}
<div class="collection-sort">
<label for="SortBy" class="collection-sort__label">{{ 'collections.sorting.title_tags' | t }}</label>
<select name="SortTags" id="SortTags" class="collection-sort__input">
{% if collection.handle %}
<option value="/collections/{{ collection.handle }}">{{ 'collections.sorting.all_of_collection' | t: collection: collection.title }}</option>
@bmodena
bmodena / wp_transient.php
Created February 10, 2016 17:07
wordpress transient
<?php
/* Credit Scotch.io : https://scotch.io/tutorials/a-guide-to-transients-in-wordpress */
// Set variable for debugging
$usecache = true;
// Check if transient exists - use if it does
$projects = get_transient( 'tmbr_cached_projects' );
if ( false === $projects || false === $usecache ) {
@bmodena
bmodena / shopify-flexslider.liquid
Last active October 19, 2022 02:29
Shopify Flexslider Integration with theme settings
<!-- add to head of your theme.liquid after moving the files into the assets folder | https://www.woothemes.com/flexslider/ -->
<!-- add only if you theme is not already including Jquery-->
{{ '//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js' | script_tag }}
<!-- FLEX Slider css and .js -->
{{ 'flexslider.css' | asset_url | stylesheet_tag }}
{{ 'jquery.flexslider.js' | asset_url | script_tag }}
<!--
add to schema json
@bmodena
bmodena / wp_query.php
Last active November 18, 2015 19:49
Wordpress WP_Query Sample of custom post type products
<?php
// Get all products
$args = array(
'posts_per_page' => -1,
'post_type' => 'products',
'orderby' => 'menu_order',
'order' => 'ASC',
'no_found_rows' => true
);
@bmodena
bmodena / gist:30284c6eaf6d16dac847
Created February 18, 2015 16:30
Advanced Custom Field - Image Field - Get Cropped image
/*
** ACF Image Helper
**
** @Param $imageId: int - image ID you are using
** @Param $size: string - image size you want to retrieve
** @Param $fieldName: string (optional) - name of the image field within the repeater
** @Return Array - image url and alt text for image
**
*/
function tmbr_get_cropped_image( $imageId, $size ) {