$ mkdir -p ~/vagrants/vccw
$ cd ~/vagrants/vccw
$ git clone git@github.com:miya0001/vccw.git .
次に以下のコードを~/.bash_profileに登録
<?php | |
/* | |
現在の日時から2日後のタイムスタンプを保存する | |
$d = 2 * 60 * 60 * 24; // 2日間 | |
$expire = current_time('timestamp', get_option("gmt_offset")) + $d; | |
update_post_meta($post->ID, '_expire', $expire); |
server { | |
# (略) | |
location ~* /wp-login\.php|/wp-admin/((?!admin-ajax\.php).)*$ { | |
index index.php index.html index.htm; | |
# 許可するIPアドレスを記述 | |
allow 192.168.0.1; | |
deny all; | |
# Basic認証のメッセージ |
/** | |
* 指定サイズ以内の画像幅、高さを算出、 | |
* img要素にそのサイズを適用する | |
* | |
* 使い方: | |
* | |
* 例) 幅150px, 高さ200px以内で画像を表示する | |
* var img = document.createElement('img'); | |
* img.src = 'http://hoge.com/img/fuga.jpg'; | |
* imgResize.resize(img, 150, 200); |
#!/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 |
#!/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 | |
/** | |
* 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 | |
/** | |
* 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 ); | |
} ); |
<?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' ) ) { |