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 readURL(input){ | |
if (input.files && input.files[0]) { | |
var reader = new FileReader(); | |
reader.onload = function (e) { | |
//e.target.result ->contain image url in encoded form | |
//Do action with e.target.result here. Dont place outside onload function. won't work | |
}; | |
reader.readAsDataURL(input.files[0]); | |
} | |
} |
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 | |
$mailer = WC()->mailer(); | |
$mails = $mailer->get_emails(); | |
$emails = wc()->mailer()->emails; // Contains all WooCommerce email classes with details | |
?> |
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
// Replace multiple strings with multiple values | |
var str = "I have a cat, a dog, and a goat."; | |
var mapObj = { | |
cat:"monkey", | |
dog:"goat", | |
goat:"cat" | |
}; | |
str = str.replace(/cat|dog|goat/gi, function(matched){ |
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
/* Dynamically add options to select field */ | |
// Assuming 'custom-select' is the class of select field | |
<select class="custom-select"> | |
<option value="a">A</option> | |
<option value="b">B</option> | |
<option value="c">C</option> | |
</select> |
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 | |
// Change product title for products in shop page | |
remove_action( 'woocommerce_shop_loop_item_title','woocommerce_template_loop_product_title', 10 ); | |
function change_product_title() { | |
$additional_text = ' More info'; | |
echo '<h2 class="woocommerce-loop-product__title">' . get_the_title() .$additional_text.'</h2>'; | |
} | |
add_action('woocommerce_shop_loop_item_title','change_product_title'); |
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 | |
$val = preg_replace('/&.*?;/', '', $val); |
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 | |
function strSlice($str, $start, $end) { | |
$end = $end - $start; | |
return substr($str, $start, $end); | |
} | |
$name = 'migthegreek'; | |
// Get substr from index 3 to 6 | |
echo strSlice($name, 3, 6); |
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 | |
$included_files = get_included_files(); | |
foreach ($included_files as $filename) { | |
if( strpos( $filename, 'file_name') !== false ){ //Check if filename | |
echo $filename.'<br>'; | |
} | |
} |
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 | |
if( is_wc_endpoint_url( 'order-received' ) ){ | |
//To check if thank you page | |
} | |
if(is_checkout()){ | |
// Check if in checkout page | |
} |
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
Outlook Conditionall rules | |
<!--[if gte mso 9]> | |
<style type="text/css"> | |
/* Your Outlook-specific CSS goes here. */ | |
</style> | |
<![endif]--> | |