Instantly share code, notes, and snippets.

View Block Click.js
delegate(document.body, '.js-clickBlock', 'click', function(e) {
// If already a link bailout
if (e.target.tagName == "A" || e.target.tagName == "BUTTON") {
return;
}
let link = e.delegateTarget.querySelector('a');
if (link && link.href) {
e.preventDefault();
View check_for_external_links
View gist:068e1b90f7b64cf45091e532fa7a3f00
<div>
<label for="sort-by">Sort by</label>
<select id="sort-by">
<option value="manual">Featured</option>
<option value="price-ascending">Price: Low to High</option>
<option value="price-descending">Price: High to Low</option>
<option value="title-ascending">A-Z</option>
<option value="title-descending">Z-A</option>
<option value="created-ascending">Oldest to Newest</option>
<option value="created-descending">Newest to Oldest</option>
View related-products.liquid
View gist:5cb70eb0dc1834020fa7b54c10cffec2
<script>
jQuery(document).ready(function($){
var images = [];
{% for image in product.images %}
images.push({url: "{{ image | product_img_url: 'medium' }}", alt: "{{ image.alt }}"});
{% endfor %}
var thumbnails = $(".thumbs");
View sale-flash.php
<?php
/**
* Product loop sale flash
*
* @author Vivek R @ WPSTuffs.com
* @package WooCommerce/Templates
* @version 1.6.4
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
View taxonomies.php
/**
* ============================================================================
* TAXONOMIES
* ============================================================================
*/
$args = array(
'labels' => array(
'add_new_item' => __('Add New Category', 'wip')
)
View query.php
/**
* QUERY DESIGNS DO VERTICAL
* http://wordpress.stackexchange.com/questions/139571/display-posts-with-same-taxonomy-term
*/
$vertical_terms = wp_get_object_terms( $post->ID, 'vertical_cat' );
if( $vertical_terms ){
// going to hold our tax_query params
View SassMeister-input.scss
// ----
// libsass (v3.2.5)
// ----
// BEM Mixins for SASS
// http://www.sitepoint.com/structuring-css-class-selectors-with-sass/
@mixin new($block) {
@at-root .#{$block} {
@content;
View wc-hide-coupons-cart-checkout.php
<?php
// hide coupon field on cart page
function hide_coupon_field_on_cart( $enabled ) {
if ( is_cart() ) {
$enabled = false;
}
return $enabled;