#lidemy API Challenge
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 | |
/** | |
* Language detector | |
* This global variable is used to detect the language that the user's browser is using. | |
* Should be passed to step to get the specified language's MO file. | |
*/ | |
function applemint_locale( $locale ) { | |
//Create a global variable so that other functions and hooks can use the variable to determine the language. | |
global $am_lang; |
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 結帳頁顯示內容。 | |
*/ | |
if ( ! function_exists( 'hyc_refund' ) ) { | |
function hyc_refund() { | |
$pid = get_theme_mod( 'hyc_refund_policy' ); | |
if ( $pid ) { | |
?> |
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 reservation_register_meta() { | |
global $post; | |
if ( 'page-shopreservations.php' != get_post_meta( $post->ID, '_wp_page_template', true ) ) { | |
//忘記 $post 是一個物件 XD 要再把 ID 指定起來 | |
return; | |
} else { | |
add_meta_box( | |
'reservation-form-id', | |
'MW WP Form ID', |
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 | |
/** | |
* Lozad | |
* Attribute replacement refernce from: https://gist.github.com/ahmadassaf/9332846 | |
*/ | |
function faster_replace_img_src( $content ){ | |
if ( function_exists( 'is_amp_endpoint' ) && ! is_amp_endpoint() ) { | |
$html = preg_replace_callback( '#(<img\s[^>]*src)="([^"]+)"#' , 'callback_img' , $content ); | |
$html = preg_replace( '/(<img\s[^>]*)class="(.*)"/', '$1 class="lozad $2"' , $html ); | |
$html = preg_replace( '/(<img\s[^>]*)srcset="(.*)"/', '$1 data-srcset="$2"' , $html ); |
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 | |
<?php | |
function mxp_ajax_get_next_page_data() { | |
$max_num_pages = $_POST['max_num_pages']; | |
$current_page = $_POST['current_page']; | |
$found_posts = $_POST['found_posts']; | |
$post_type = $_POST['post_type']; | |
$taxonomy = $_POST['taxonomy']; | |
$term = $_POST['term']; | |
$nonce = $_POST['nonce']; |
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
#!/bin/bash | |
# Program: | |
# Check if mysql is down, if down, turn it on. | |
# History: | |
# 2019/02/25 First Release by Eric | |
# 2019/03/05 Echo date time in logs for better readability. | |
UP=$(service mysql status|grep 'running' | wc -l); | |
now=$(date); | |
if [ "$UP" -ne 1 ]; |
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 |
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 | |
$args = array( | |
'template' => array( | |
array( 'core/heading', array( | |
'placeholder' => 'Payment Options', | |
'content' => 'Payment Options', | |
) ), | |
array( 'acf/custom-block' ), | |
array( 'core/heading', 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( 'wpcf7_init', 'wpcf7_add_address_tag' ); | |
function wpcf7_add_address_tag () { | |
wp_enqueue_script( 'address-pick', get_template_directory_uri() . '/js/tw-city-selector/dist/tw-city-selector.min.js', array( 'jquery' ), true ) ; | |
//Get the js file from https://github.com/dennykuo/tw-city-selector | |
wpcf7_add_form_tag( array( 'address', 'address*' ), | |
//To-do: 還沒處理必填欄位的功能 | |
'wpcf7_add_address_tag_handler', array( 'name-attr' => true ) ); | |
} |
NewerOlder