Skip to content

Instantly share code, notes, and snippets.

View huanyichuang's full-sized avatar

Huanyi Chuang (Eric) huanyichuang

View GitHub Profile
@huanyichuang
huanyichuang / check-plugin.php
Last active December 18, 2018 05:38
Use this action to check if required WordPress plugins are already installed.
<?php
/**
* 因為在開發佈景主題的時候,會使用其他外掛的 shortcodes 來輔助。
* 掛在佈景主題的 functions.php 裡面,可以提醒使用者安裝相容的外掛。
*/
add_action( 'admin_init', 'check_plugin');
function check_plugin() {
$plugins = array(
'plugin-name' => array(
'name' => 'plugin-name',
@huanyichuang
huanyichuang / register_post_type.php
Last active November 14, 2018 02:58
用 Post Type 整合 Owl Carousel
<?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" ),