View montana-zip-counties
This file contains 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
$montana_zip_counties = [ | |
"59001" => "Stillwater", | |
"59002" => "Yellowstone", | |
"59003" => "Rosebud", | |
"59004" => "Rosebud", | |
"59006" => "Yellowstone", | |
"59007" => "Carbon", | |
"59008" => "Carbon", | |
"59010" => "Treasure", | |
"59011" => "Sweet Grass", |
View javascript-debounce
This file contains 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
function debounce(func, wait, immediate?) { | |
var timeout; | |
return function() { | |
var context = this, args = arguments; | |
var later = function() { | |
timeout = null; | |
if (!immediate) func.apply(context, args); | |
}; | |
var callNow = immediate && !timeout; | |
clearTimeout(timeout); |
View functions.php
This file contains 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
// Display Price For Variable Product With Same Variations Prices | |
add_filter('woocommerce_available_variation', function ($value, $object = null, $variation = null) { | |
if ($value['price_html'] == '') { | |
$value['price_html'] = '<span class="price">' . $variation->get_price_html() . '</span>'; | |
} | |
return $value; | |
}, 10, 3); |
View gist:ce8d86175e05cdf5fb7e
This file contains 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
<?php | |
$args = array( | |
'post_type' => 'product', | |
'meta_key' => '_featured', | |
'meta_value' => 'no', | |
'posts_per_page' => -1, | |
'order' => 'asc', | |
); | |
$products = array(); | |
$products_query = new WP_Query( $args ); |
View gist:6ce386ae68da98d26088
This file contains 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
if( function_exists('acf_add_options_page') ) { | |
acf_add_options_page(array( | |
'page_title' => 'Fiera Woocommerce Settings', | |
'menu_title' => 'Fiera Woo', | |
'menu_slug' => 'fiera-woocommerce-settings', | |
'capability' => 'edit_posts', | |
'position' => 62, | |
'icon_url' => 'dashicons-cart', | |
)); |
View gist:7ec04f6c3eb12c8a029b
This file contains 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
function clearfix_shortcode( $atts, $content = null ) { | |
extract( shortcode_atts( | |
array( | |
'' => '', | |
), $atts ) | |
); | |
$result = '<div class="clear"></div>'; | |
return $result; |
View gist:bf0e089eed7423672132
This file contains 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
console.log('%c Console Style', 'color: #be226e; font-size: 24px;'); |
View gist:bbabae80cefc8d0ae9e8
This file contains 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
$('#my-library').sortable({ | |
// containment: "parent", | |
items: "> li.set-item", | |
update: function(e, ui){ | |
console.log('UPDATE'); | |
var new_order = $(this).sortable('toArray'); | |
updateSortOrder(new_order); | |
} | |
}); |
View gist:f52dc92f52a6211aa022
This file contains 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
add_action('wp_ajax_library_set_update_sort', 'library_set_update_sort'); | |
add_action('wp_ajax_nopriv_library_set_update_sort', 'library_set_update_sort'); | |
function library_set_update_sort() { | |
$return = array(); | |
$order = array(); | |
$new_order = $_POST['new_order']; | |
foreach ($new_order as $i => $row) { | |
$row = split('-', $row); | |
$my_library_id = $row[0]; |
View gist:4ec934c221a32daa8468
This file contains 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
function isValidEmailAddress(emailAddress) { | |
var pattern = new RegExp(/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i); | |
return pattern.test(emailAddress); | |
} |
NewerOlder