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
Parameters #Parameters | |
$handle | |
(string) (Required) Name of the script. Should be unique. | |
$src | |
(string) (Optional) Full URL of the script, or path of the script relative to the WordPress root directory. | |
Default value: '' |
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
//Create folder for the child theme | |
mkdir -p /var/www/<your-website-directoy>/wp-content/themes/child-storefront/woocommerce/emails | |
//Add the customer-on-hold-order.php to the child theme emails template directory | |
cp /var/www/<your-website-directoy>/wp-content/plugins/woocommerce/templates/emails/customer-on-hold-order.php /var/www/<your-website-directoy>/wp-content/themes/child-storefront/woocommerce/emails | |
//Dont forget to grant permission to the folder :D | |
chown -R www-data:www-data /var/www/<your-website-directoy>/wp-content/themes/child-storefront/woocommerce/emails |
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
<p><?php | |
$vendor_id = 0; | |
foreach ( $order->get_items() as $item_id => $item ) { | |
$meta_data = $item->get_formatted_meta_data(); | |
// Get the meta data value of vendor id from one of the order item | |
$vendor_id = $item->get_meta("_vendor_id"); | |
break; | |
} | |
//get vendor data |
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
from collections import defaultdict | |
def group_by_owners(files): | |
# Grouping dictionary keys by value | |
res = defaultdict(list) | |
for key, val in files.items(): | |
res[val].append(key) | |
return res | |
if __name__ == "__main__": |
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
class IceCreamMachine: | |
def __init__(self, ingredients, toppings): | |
self.ingredients = ingredients | |
self.toppings = toppings | |
def scoops(self): | |
final_scoops = [] | |
for ingredient in self.ingredients: | |
for topping in self.toppings: |
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
function is_site_admin(){ | |
return in_array('administrator', wp_get_current_user()->roles); | |
} | |
if (is_site_admin()) { | |
add_filter('wcfm_marketplace_settings_fields_general', 'add_vendor_verified', 10, 2); | |
add_action( 'wcfm_vendor_settings_update', 'fn_wcfm_vendor_settings_storetype_update', 30, 2); | |
} | |
function add_vendor_verified($settings_fields_general, $vendor_id){ |
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
$malaysia_phone_patterns = "#(^[6]\w*$)|(^[+][6]\w*$)#"; | |
$number = get_usermeta($post_author_id,'billing_phone'); | |
preg_match($malaysia_phone_patterns, $number, $matches); | |
if ($matches) { | |
// full pattern of all. | |
//means one of the pattern is captured | |
if ($matches[0]) { | |
//do nothing. | |
} | |
// first pattern matches with 6 at start |
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
// WP_CRON | |
// register monthly interval | |
add_filter('cron_schedules','my_cron_definer'); | |
function my_cron_definer($schedules){ | |
$schedules['monthly'] = array('interval'=> 2592000, 'display'=> __('Once Every 30 Days') ); | |
return $schedules; | |
} | |
// JOB : SEND EMAIL TO USERS WHO IS NOT ONLINE FOR MORE THAN 1 MONTH. NOTIFY THAT THEIR PRODUCT WILL BE REMOVE | |
// IF THEY STILL NOT ONLINE FOR 3 MONTHS. |
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
root@foodah:/tmp# mysqldump -u root -p mydatabase > /tmp/mydatabase_backup_2020.sql |
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
gdrive push -destination F_EOL/DATABASE mydatabase_backup_2020.sql |