Skip to content

Instantly share code, notes, and snippets.

View ShinichiNishikawa's full-sized avatar
🏠
Working from home

Shinichi Nishikawa ShinichiNishikawa

🏠
Working from home
View GitHub Profile
@ShinichiNishikawa
ShinichiNishikawa / postMetaAfterTitle.php
Last active December 15, 2015 08:49
WordPressの管理画面の投稿タイトルの下に、ポストメタの入力欄を追加する
// タイトル下にタイトル2を追加
add_action( 'edit_form_after_title', 'nskw_postMetaAfterTitle' );
function nskw_postMetaAfterTitle() {
global $post;
$metaKey = 'title2';
if ( empty ( $post ) || 'post' !== get_post_type( $GLOBALS['post'] ) ) {
return;
}
if ( ! $content = get_post_meta( $post->ID, $metaKey, TRUE ) ) {
$content = '';
@ShinichiNishikawa
ShinichiNishikawa / functions.php
Last active December 16, 2015 16:40
テーマ作るときのデフォルトのfunctions.php
<?php
// アイキャッチ
add_theme_support('post-thumbnails');
// set_post_thumbnail_size(443, 171, true);
// その他の画像サイズ
//add_image_size( 'sizename', 100, 100, true );
// jQuery の差し替えとその他のJSの登録
<?php
// エディタの下にテキストエリアを追加
add_action( 'edit_form_after_editor', 'nskw_postMetaAfterEditor' );
function nskw_postMetaAfterEditor() {
global $post;
$metaKey = 'afterEditor';
if ( empty ( $post ) || 'post' !== get_post_type( $GLOBALS['post'] ) ) {
return;
}
if ( ! $content = get_post_meta( $post->ID, $metaKey, TRUE ) ) {
<?php
/**
* @package content_mayuge_systems
* @version 0.2
*/
/*
Plugin Name: Content Mayuge Systems
Plugin URI: http://wordpress.org/extend/plugins/hello-dolly/
Description: 本文中に句点「。」があると「( ・ิω・)╯ิ」がくっつきます。
Author: gatespace
@ShinichiNishikawa
ShinichiNishikawa / gist:11371541
Last active August 29, 2015 14:00 — forked from wokamoto/gist:11365599
おかもとさんより
<?php
add_filter( 'the_content', 'my_pre_shortcode', 7 );
function my_pre_shortcode( $content ) {
global $shortcode_tags;
$shortcode_tags_org = $shortcode_tags;
remove_all_shortcodes();
add_shortcode( 'code', 'code_shortcode_handler' );
$content = do_shortcode( $content );
@ShinichiNishikawa
ShinichiNishikawa / add_body_class_locale.php
Last active August 29, 2015 14:02
Add locale to body_class
// add locale such as locale_ja, locale_en_US to body class
add_filter( 'body_class', 'add_body_class_locale' );
function add_body_class_locale( $classes ) {
$classes[] = 'locale_' . sanitize_html_class( get_bloginfo('language') );
return $classes;
}
@ShinichiNishikawa
ShinichiNishikawa / newreview
Last active June 26, 2016 14:08
Creating a whole new Theme Review environmet in 1 minute using wp-cli
wp db reset --yes
wp core install --url=http://theme-review.loc --title="This is a really long long title to check if this theme design doesn't break with the long site title" --admin_user=admin --admin_password=admin --admin_email=example@example.com
wp core update
wp plugin install theme-check debug-bar log-deprecated-notices monster-widget wordpress-importer show-current-template customizer-theme-resizer --activate
wp plugin install wordpress-beta-tester debogger jetpack
wp plugin update --all
wp option update blogdescription "I'm in the theme review process and this is a very very long tagline to see if this long tagline text string in WordPress doesn't break the design of the theme header and else."
wp option update posts_per_page 5
wp option update thread_comments 1
wp option update thread_comments_depth 3
@ShinichiNishikawa
ShinichiNishikawa / Movefile.init
Last active December 22, 2015 07:10
Movefile for my local
local:
vhost: "http://example.dev"
wordpress_path: "/Users/papa/Sites/example.dev"
database:
name: "example"
user: "root"
password: "root"
host: "localhost"
*.log
*.sql
.DS_Store
.htaccess
*.map
error_log
Movefile
wp-cli.yml
sitemap.xml
sitemap.xml.gz
wp core download
wp core config --dbname=sample --dbuser=root --dbpass=root
wp core install --url=http://example.dev --title="WordPress Sample Site" --admin_user=nishikawa --admin_password=pass --admin_email=example@example.com
wp plugin install show-current-template wp-basic-auth theme-check plugin-check wp-multibyte-patch --activate
wp plugin install wordpress-beta-tester jetpack contact-form-7 vk-all-in-one-expansion-unit
wp plugin delete hello
wp option update blogdescription "This is a new project!!"
wp option update posts_per_page 5
wp option update thread_comments 1
wp option update thread_comments_depth 3