Skip to content

Instantly share code, notes, and snippets.

View waviaei's full-sized avatar
🤔

Toru Miki waviaei

🤔
View GitHub Profile
@waviaei
waviaei / gist:3438293
Created August 23, 2012 16:26
WordPress / Tiny MCE / customize format choices
//Not to show h1 on Tiny MCE
function custom_editor_settings( $initArray ){
$initArray['theme_advanced_blockformats'] = 'p,address,pre,code,h2,h3,h4,h5,h6';
return $initArray;
}
add_filter( 'tiny_mce_before_init', 'custom_editor_settings' );
@waviaei
waviaei / gist:3487249
Created August 27, 2012 10:25
Strip away all width="" and height="" from <img /> of post thumbnails
function strip_width_height_html( $html ) {
$html = preg_replace( '/(width|height)=\"\d*\"\s/', "", $html );
return $html;
}
add_filter ( 'post_thumbnail_html', 'strip_width_height_html');
@waviaei
waviaei / gist:4577142
Last active December 30, 2016 15:22
WordPress: when "read more" link is used, WordPress will automatically add "#more" anchor to the link. This is function to remove it. via http://webdesignrecipes.com/wordpress-functions-php-snipets/
/* remove more-anchor from read more link */
function remove_more_jump_link($link) {
$offset = strpos($link, '#more-');
if ($offset) {
$end = strpos($link, '"',$offset);
}
if ($end) {
$link = substr_replace($link, '', $offset, $end-$offset);
}
return $link;
function my_post_types() {
// Set labels
$labels = array(
'name' => 'Questions',
'singular_name' => 'Question',
'add_new' => 'Add New Question',
'add_new_item' => 'Add New Question',
'edit_item' => 'Edit Question',
'new_item' => 'New Question',
'all_items' => 'All Questions',
@waviaei
waviaei / gist:5993325
Created July 14, 2013 05:43
Terminal command for Mac OS X, to enable textcopy insde qcuicklook
//To enable textcopy on QuickLook
$ defaults write com.apple.finder QLEnableTextSelection -bool TRUE; killall Finder
//To reset above
$ defaults delete com.apple.finder QLEnableTextSelection; killall Finder
@waviaei
waviaei / osx-customize-ss.txt
Created February 20, 2014 02:02
From http://weekly.ascii.jp/elem/000/000/177/177317/ Insert text between " " to change the スクリーンショット. Note that it cannot delete the space between スクリーンショット and the date.
defaults write com.apple.screencapture name ""
@waviaei
waviaei / clean.sh
Last active November 29, 2017 00:39
cleaning unwanted files
#!/bin/sh
# Mac: Unlock everything
sudo chflags -R nouchg .
# Mac: Delete all .DS_Store
find . -name ".DS_Store" -print -exec rm {} ";"
# DW: Delete all /_notes/
find . -name "_notes" -print -exec rm -r {} ";"
@waviaei
waviaei / site.yml
Created May 14, 2015 05:34
site.yml for vccw
# encoding: utf-8
# vim: ft=ruby expandtab shiftwidth=2 tabstop=2
#
# General Settings
#
wp_box: miya0001/vccw
chef_cookbook_path: ./provision
#
# OS files
.DS_Store
Thumbs.db
# Dreamweaver
_notes/
dwsync.xml
*.LCK
* - Copy
* - コピー
@waviaei
waviaei / functions.php
Last active September 3, 2018 02:46
Test different patterns of 'post_status' and 'perm' arguments set for query
/**
* Test different patterns of 'post_status' and 'perm' arguments set for query
* publish, pending, draft, auto-draft, future, private, inherit, trash, any
*/
// Add Shortcode
function status_permission_test_shortcode() {
// the query
$args = array(
'post_status' => array( 'publish' ),