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 | |
class VeritransController { | |
public function index() { | |
global $woocommerce; | |
// get veritrans keys depending on environment (sandbox/production) | |
$vt = get_option('woocommerce_veritrans_settings'); | |
if (empty($vt)) { | |
return Response::json(array("success"=>false,"error"=>"veritrans setting not found"),200,array());; | |
} |
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 | |
/* WooCommerce < 3.0.4 */ | |
add_filter('woocommerce_checkout_fields','reorder_fields'); | |
function reorder_fields($fields) { | |
$billing_field_order = array( | |
'billing_first_name', | |
'billing_last_name', | |
'billing_address_1', | |
'billing_email', |
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 | |
add_filter('pok_rates', 'filter_couriers', 10, 2); | |
function filter_couriers($rates, $package) { | |
$filtered_rates = array(); | |
$selected_courier = array( | |
'JNE - REG', | |
'JNE - OKE', | |
'JNE - YES' | |
); |
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
class Flash_Alert { | |
private $session; | |
function __construct() { | |
$this->session = new \Tiga\Session(); | |
} | |
public function error($message) { | |
$this->add('danger', $message); |
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
set @latitude = xxx; — center latitude | |
set @longitude = xxx; — center longitude | |
set @distance = xx; — search distance (miles) | |
select p.ID, p.post_name, ((ACOS(SIN(@latitude * PI() / 180) * SIN('latitude.meta_value' * PI() / 180) + COS(@latitude * PI() / 180) * COS('latitude.meta_value' * PI() / 180) * COS((@longitude – 'longitude.meta_value') * PI() / 180)) * 180 / PI()) * 60 * 1.1515) AS distance | |
from wp_posts p | |
left join wp_postmeta latitude on latitude.post_id = p.ID and latitude.meta_key = '_latitude' | |
left join wp_postmeta longitude on longitude.post_id = p.ID and longitude.meta_key = '_longitude' | |
having distance < @distance; |
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 | |
$rules = array( | |
"ruleset_f45Is7PCFWd4mjU" => array( | |
"label" => "Ruleset Name", | |
"enabled" => true, | |
"rules" => array( | |
"rule_mVk9lHtMJLw38vD" => array( | |
"label" => "Rule Name", | |
"method" => "bulk", | |
"rewards" => array( |
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 | |
add_action( 'admin_menu', 'tair_admin_menu' ); | |
function tair_admin_menu() { | |
add_menu_page( 'Tes airtable', 'Tes airtable', 'manage_options', 'tair', 'tair_admin' ); | |
} | |
function tair_admin() { | |
global $wp_version; | |
$records = wp_remote_get( 'https://api.airtable.com/v0/appOc1ESRgBBFWbW9/Places?view=High%20priority', array( |
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 | |
// method 1. | |
add_filter( 'woocommerce_checkout_fields', function( $fields ) { | |
$fields['billing']['billing_state']['label'] = 'Provinsi'; | |
$fields['billing']['billing_city']['label'] = 'Kabupaten'; | |
$fields['billing']['billing_district']['label'] = 'Kecamatan'; | |
$fields['shipping']['shipping_state']['label'] = 'Provinsi'; | |
$fields['shipping']['shipping_city']['label'] = 'Kabupaten'; | |
$fields['shipping']['shipping_district']['label'] = 'Kecamatan'; |
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 | |
// Pastikan plugin berikut telah terinstall & aktif | |
// Action Scheduler : https://wordpress.org/plugins/action-scheduler/ | |
// WP Monolog : https://git.tonjoo.com/tonjoo/wp-monolog | |
/** | |
* Create job queue | |
* | |
* Param 1: Timestamp kapan job akan dirun. Isi pakai time() kalau job ingin dirun sekarang juga. |
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 | |
$variable = "Some value"; // bisa array juga. | |
add_action( 'hook_name, function() use ($variable) { | |
// callback. | |
}); |
OlderNewer