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 | |
$response = wp_remote_post($url, $args = array()); | |
$header_content = (array) wp_remote_retrieve_headers( $response ); | |
$header = current($header_content); | |
$data = wp_remote_retrieve_body( $response ); | |
if ( array_key_exists('content-type', $header) ) { | |
if ( $header['content-type'] === 'application/pdf') { | |
header("Content-type: application/pdf"); | |
header('Content-Length: '.strlen( $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
<?php | |
// registers the gateway | |
function pw_edd_register_gateway($gateways) { | |
$gateways['ecpay_credit'] = array( 'admin_label' => '綠界-信用卡', 'checkout_label' => __('綠界-信用卡', 'your_textdomain')); | |
return $gateways; | |
} | |
add_filter('edd_payment_gateways', 'pw_edd_register_gateway'); | |
// process the payment |
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
/** | |
* Get customer ip | |
* | |
* @return string | |
*/ | |
private function get_the_user_ip() { | |
if ( ! empty( $_SERVER['HTTP_CLIENT_IP'] ) ) { | |
// check ip from share internet |
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 | |
// $raw_address = Array ( | |
// [first_name] => YU CHENG | |
// [last_name] => WANG | |
// [company] => | |
// [address_1] => 新北路 | |
// [address_2] => | |
// [city] => 板橋區 | |
// [state] => NEW TAIPEI CITY | |
// [postcode] => 100 |
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 | |
add_filter( 'woocommerce_marketing_menu_items', '__return_empty_array' ); |
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 | |
add_action('show_user_profile', 'mys_additional_profile_fields', 9); | |
add_action('edit_user_profile', 'mys_additional_profile_fields', 9); | |
function mys_additional_profile_fields($user) | |
{ | |
echo '<h2>連結的推薦人</h2>'; | |
$customer = affwp_get_customer($user->user_email); |
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
/* ----- | |
* 若您希望全部訂單都顯示,請將以下內容加入 functions.php 中 | |
----- */ | |
add_action('woocommerce_thankyou', 'shopcom_add_content_thankyou', 5); | |
function shopcom_add_content_thankyou() | |
{ | |
echo '<h2 class="h2thanks">提醒您:</h2><p class="pthanks">以下都是詐騙:訂單設錯、訂單金額有誤、設成分期每月扣款、重覆訂購多筆、宅配或超商出錯、簽收單牽成簽帳單、條碼刷錯、重複扣款。歹徒會以更改訂單要求退費給您為由,要求您操作ATM,這些都是詐騙手法。若遇可疑來電,隨時可撥打165反詐騙諮詢專線。</p>'; | |
} |
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 | |
function oneday_bulk_add_user_to_subscription() { | |
$args= array( | |
array( 'role' => 'Subscriber' ) | |
); | |
// The Query | |
$user_query = new WP_User_Query( $args ); | |
// User Loop |
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 | |
add_filter('jetpack_photon_pre_args', 'jetpackme_custom_photon_compression' ); | |
function jetpackme_custom_photon_compression( $args ) { | |
$args['quality'] = 80; | |
$args['strip'] = 'all'; | |
return $args; | |
} |
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 | |
//不可重複購買的分類(可多個) | |
global $non_repeatable_cats; | |
$non_repeatable_cats = array( 21, 22 ); | |
function foo_wc_purchase_disabled_message() { | |
global $product,$non_repeatable_cats; |
NewerOlder