#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 | |
/** | |
* Post Type: YouTube Videos. | |
*/ | |
$labels = array( | |
"name" => __( "YouTube Videos", "YourTextDomain" ), | |
"singular_name" => __( "YouTube Video", "YourTextDomain" ), | |
"menu_name" => __( "YouTube Video", "YourTextDomain" ), | |
"all_items" => __( "All YouTube Videos", "YourTextDomain" ), |
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 | |
/** | |
* 因為在開發佈景主題的時候,會使用其他外掛的 shortcodes 來輔助。 | |
* 掛在佈景主題的 functions.php 裡面,可以提醒使用者安裝相容的外掛。 | |
*/ | |
add_action( 'admin_init', 'check_plugin'); | |
function check_plugin() { | |
$plugins = array( | |
'plugin-name' => array( | |
'name' => 'plugin-name', |
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 ) ); | |
} |
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 |
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 | |
<?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
<?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 | |
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', |
OlderNewer