Skip to content

Instantly share code, notes, and snippets.

View aliaramli's full-sized avatar
🎯
Focusing

alia aliaramli

🎯
Focusing
  • Malaysia
View GitHub Profile
<?php
/** Template Name: Page Delivery Calculator
*
* This is the template that displays all pages by default.
* Please note that this is the WordPress construct of pages
* and that other 'pages' on your WordPress site will use a
* different template.
*
* @package WordPress
* @subpackage Storefront Child
var delivery_rate = 0.8;
var delivery_charge = 3;
if (distance_in_kilo >3){
delivery_charge = distance_in_kilo * delivery_rate;
delivery_charge = Math.round(delivery_charge.toFixed(2)*10)/10;
}
$(function() {
// add input listeners
google.maps.event.addDomListener(window, 'load', function () {
var from_places = new google.maps.places.Autocomplete(document.getElementById('from_places'));
var to_places = new google.maps.places.Autocomplete(document.getElementById('to_places'));
google.maps.event.addListener(from_places, 'place_changed', function () {
var from_place = from_places.getPlace();
var from_address = from_place.formatted_address;
$('#origin').val(from_address);
gdrive push -destination F_EOL/WEBSITE mywebsite.*
# Compressing file using Gz
tar -czvf mywebsite.tar.gz /var/www/mywebsite
# Compressing file using Zip (more Windows friendly)
zip -r mywebsite.zip /var/www/foodahlite
gdrive push -destination F_EOL/DATABASE mydatabase_backup_2020.sql
root@foodah:/tmp# mysqldump -u root -p mydatabase > /tmp/mydatabase_backup_2020.sql
// 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.
$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
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){