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
var used = []; | |
var elements = null; | |
var skipelements = [ | |
'nav' | |
]; | |
//get all elements | |
if (typeof document.getElementsByTagName != 'undefined') { | |
elements = document.getElementsByTagName('*'); | |
} |
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
<?php | |
/** | |
* Disable jQuery Migrate in WordPress. | |
* | |
*/ | |
function crave_remove_jquery_migrate( &$scripts) { | |
if(!is_admin()) { | |
$scripts->remove('jquery'); | |
} |
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
<?php | |
/** | |
* Remove admin bar | |
**/ | |
add_filter('show_admin_bar', '__return_false'); | |
/** | |
* Register Custom Post Type | |
**/ |
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
<?php | |
if ( is_page_template( 'template-name.php' ) ) { | |
// template-name.php is used | |
} | |
?> |
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
<?php | |
$product = wc_get_product($product_id); | |
if( $product->is_on_sale() ) { | |
$discount = $product->get_regular_price() - $product->get_sale_price(); | |
} | |
else { | |
$discount = 0; | |
} | |
?> |
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
<?php | |
/** | |
* Pre-populate Woocommerce checkout fields | |
* Note that this filter populates shipping_ and billing_ fields with a different meta field eg 'first_name' | |
*/ | |
add_filter('woocommerce_checkout_get_value', function($input, $key ) { | |
if($key == 'billing_first_name') { | |
return 'NEW FIRST NAME'; | |
} | |
if($key == 'billing_last_name') { |
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
Weird Character => True Character | |
’ => ' | |
’ => ' | |
‘ => ' | |
‚Äã => nothing | |
‚Äã => nothing | |
‚Ķ => … | |
• => - | |
‚Äê => - | |
-­ => - |
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
<div class="grid-container"> | |
{% for collection in collections %} | |
<div class="grid-item"> | |
<div class="grid-item-photo"> | |
<a href="{{ collection.url }}"> | |
{% for image in collection.images limit:1 %}<img src="{{ image }}" alt="{{ image.alt | escape }}">{% endfor %} | |
</a> | |
</div> | |
<div class="grid-item-title"> | |
<a href="{{ collection.url }}">{{ collection.title }}</a> |
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
// this is to create a Nested Array | |
// eg. multiLevelArray[0][0] | |
var multiLevelArray = new Array(loop.length); | |
for (var k = 0; k < loop.length; k++) { | |
multiLevelArray[k] = new Array(loop[k].valueA, loop[k].valueB); | |
} |
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
Array( | |
[key] => ############################ | |
[product_id] => 57317 | |
[variation_id] => 0 | |
[variation] => Array() | |
[quantity] => 1 | |
[data_hash] => ########################## | |
[line_tax_data] => Array( | |
[subtotal] => Array() | |
[total] => Array() |