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 | |
/** | |
* Remove recaptcha if it's not contact form. | |
*/ | |
add_action( 'wp_enqueue_scripts', function() { | |
if ( is_singular() && has_shortcode( get_queried_object()->post_content, 'contact-form-7' ) ) { | |
return; | |
} | |
wp_deregister_script( 'google-recaptcha' ); |
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_labels = [ | |
'name' => __( '', 'domain' ), | |
'singular_name' => __( '', 'domain' ), | |
'add_new' => __( '', 'domain' ), | |
'add_new_item' => __( '', 'domain' ), | |
'edit_item' => __( '', 'domain' ), | |
'new_item' => __( '', 'domain' ), | |
'view_item' => __( '', 'domain' ), | |
'view_items' => __( '', 'domain' ), |
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
#!/usr/bin/env bash | |
set -e | |
# Activate WP Importer plugin. | |
wp plugin install wordpress-importer --activate | |
# Don't know why, but failed importing directly. | |
wget https://raw.githubusercontent.com/WPTRT/theme-unit-test/master/themeunittestdata.wordpress.xml | |
# Import | |
wp import themeunittestdata.wordpress.xml --authors=create |
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
#!/usr/bin/env php | |
# 利用方法 | |
# 1. このファイルをホームフォルダなどのパスが通っている場所に maisu として保存します。 | |
# wget https://gist.githubusercontent.com/fumikito/5496923ec71e4cc891f263029be79dec/raw/6154450c6a547d14522a2ee7aa6ffd438fcfe3b7/maisu.php -O ~/bin/maisu | |
# 2. 実行権限を付与します。 | |
# chmod +x maisu | |
# 3. ファイルを指定して実行します。 | |
# maisu example.txt | |
# => 400字詰原稿用紙(20字×20行)換算で1枚(12行)です。 | |
# |
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
# シェルBashに変更(要パスワード入力) | |
chsh -s /usr/local/bin/bash | |
echo "export LANG=ja_JP.UTF-8" >> .bash_profile | |
source .bash_profile | |
# 鍵認証(コピペ) | |
vim ~/.ssh/authorized_keys | |
chmod 600 ~/.ssh/authorized_keys | |
# コマンドインストール |
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 | |
/** | |
* Hide specific media from media library. | |
*/ | |
/** | |
* Case 1. Do not allow gif. | |
* | |
* This filter will be triggered by media library's AJAX action. | |
* |
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 | |
/** | |
* Register shortcode [my-template] | |
* | |
* File based short code. | |
* | |
* @param array $atts Shoutcode attribures. | |
* @param string $string Content wrapped in shortcode. | |
* @return string Rendered result. | |
*/ |
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
# | |
# Backup WordPress contents. | |
# | |
set -e | |
# Move to WordPress dir | |
cd /var/www/wordpress | |
# Remove if exists. |
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 | |
# composer require sunra/php-simple-html-dom-parser | |
require __DIR__ . '/vendor/autoload.php'; | |
// Change file size because fb message archive is very big data. | |
define( 'MAX_FILE_SIZE', 1000000000 ); | |
$dom = Sunra\PhpSimple\HtmlDomParser::file_get_html( 'messages.htm' ); | |
$messages = []; |
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 | |
// パスを設定。なぜかこれがないと動かず。 | |
putenv('PATH=/home/ec2-user/.nvm/versions/node/v6.11.0/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/opt/aws/bin:/home/ec2-user/.local/bin:/home/ec2-user/bin'); | |
//リリースするブランチの指定 | |
$deploy_ref = 'refs/heads/master'; | |
//logファイルの指定 | |
$log_path = '/var/www/wordpress/wp-content/git.log'; |