$ mkdir -p ~/vagrants/vccw
$ cd ~/vagrants/vccw
$ git clone git@github.com:miya0001/vccw.git .
次に以下のコードを~/.bash_profileに登録
| <?php | |
| /* | |
| Plugin Name: Exclude Algolia search | |
| Plugin URI: | |
| Description: Algolia の検索結果から除外するフラグを追加。WP Search with Algolia プラグインが必要。 | |
| Version: 0.1 | |
| Author: gatespace | |
| Author URI: https://gatespace.jp | |
| License: GPLv2 or later | |
| */ |
| #!/usr/bin/env node | |
| 'use strict' | |
| const PORT = 8889; | |
| const HOST = '192.168.10.1'; | |
| const dgram = require('dgram'); | |
| const client = dgram.createSocket('udp4'); |
| <?php | |
| /** | |
| * Regsiter script | |
| */ | |
| add_action( 'wp_enqueue_scripts', function() { | |
| // Set dependency to wp-api, which has nonce and endpoint root. | |
| wp_enqueue_script( 'api-handler', '/path/to/api-handler.js', [ 'jquery', 'wp-adpi' ], '1.0', true ); | |
| } ); |
| #!/usr/bin/env bash | |
| set -eu | |
| wp @all core verify-checksums | |
| wp @all vackup create | |
| wp @all core update | |
| wp @all core language update | |
| wp @all plugin update --all |
| <?php | |
| /** | |
| * Get Google Page Speed Screenshot | |
| * | |
| * Uses Google's Page Speed API to generate a screenshot of a website. | |
| * Returns the image as a base64 jpeg image tag | |
| * | |
| * Usage Example: | |
| * echo getGooglePageSpeedScreenshot("http://ghost.org", 'class="thumbnail"'); | |
| * |
| <?php | |
| function get_holidays_this_month($year, $month){ | |
| // 月初日 | |
| $first_day = mktime(0, 0, 0, intval($month), 1, intval($year)); | |
| // 月末日 | |
| $last_day = strtotime('-1 day', mktime(0, 0, 0, intval($month) + 1, 1, intval($year))); | |
| $api_key = 'YOUR API KEY HERE'; | |
| $holidays_id = 'outid3el0qkcrsuf89fltf7a4qbacgt9@import.calendar.google.com'; // mozilla.org版 |
| <?php | |
| // check to see if there is a post type in the URL | |
| if ( isset( $_GET['post_type'] ) && $_GET['post_type'] ) { | |
| // save it for later | |
| $post_type = $_GET['post_type']; | |
| // check to see if a search template exists | |
| if ( locate_template( 'search-' . $post_type . '.php' ) ) { |
| <?php | |
| /** | |
| * [list_searcheable_acf list all the custom fields we want to include in our search query] | |
| * @return [array] [list of custom fields] | |
| */ | |
| function list_searcheable_acf(){ | |
| $list_searcheable_acf = array("title", "sub_title", "excerpt_short", "excerpt_long", "xyz", "myACF"); | |
| return $list_searcheable_acf; | |
| } |