Skip to content

Instantly share code, notes, and snippets.

View huanyichuang's full-sized avatar

Huanyi Chuang (Eric) huanyichuang

View GitHub Profile
<?php
/**
* 使用方式:在頁面中建立 "退貨政策" 後,從 [自訂] 中選取退貨政策的頁面,便會出現在結帳頁中。
* 在 WooCommerce 結帳頁顯示內容。
*/
if ( ! function_exists( 'hyc_refund' ) ) {
function hyc_refund() {
$pid = get_theme_mod( 'hyc_refund_policy' );
if ( $pid ) {
?>
@huanyichuang
huanyichuang / language-detector.php
Created July 31, 2020 05:02
Because the pages in the new version doesn't need to be edited (hard-coded), it seems better to use PO/MO directly for the multi-lingual website.
<?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;