Skip to content

Instantly share code, notes, and snippets.

View torounit's full-sized avatar

Hiroshi Urabe torounit

View GitHub Profile
@torounit
torounit / Admin_Column_Custom_Field.php
Last active February 29, 2016 14:39
WordPressの投稿一覧にカスタムフィールドを表示する。並び替えにも対応。
<?php
Class Admin_Column_Custom_Field {
/** @var string */
private $field_key;
/** @var string */
private $field_label;
@torounit
torounit / gist:883f016f0ff51f535557
Created February 18, 2015 06:41
PHPでRubyっぽいループ
<?php
//each
array_walk($array, function($item) {
});
//upto
array_walk(range(1,5), function($i) {
@torounit
torounit / class-debug-bar-js.php
Created February 24, 2015 05:49
class-debug-bar-js.php fix.
<?php
class Debug_Bar_JS extends Debug_Bar_Panel {
var $real_error_handler = array();
function init() {
$this->title( __('JavaScript', 'debug-bar') );
// attach here instead of debug_bar_enqueue_scripts
// because we want to be as early as possible!
@torounit
torounit / prime-strategy-bread-crumb.php
Last active August 29, 2015 14:16
カスタムタクソノミーアーカイブの時に、get_term_linkが失敗するバグを修正。
<?php
/*
Plugin Name: Prime Strategy Bread Crumb
Plugin URI: http://www.warna.info/archives/1310/
Description: This plugin adds the function to display breadcrumbs (topic path) navigation. You can use display styles, lots of parameters of styles and original plugin hooks of breadcrumbs navigation, and you can customize navigations flexibly.
Author: Hitoshi Omagari
Version: 1.0.5
Author URI: http://www.warna.info/
License: GPLv2 or later
Text Domain: ps-bread-crumb
{
"auto_complete": true,
"blod_folder_labels": true,
"close_windows_when_empty": false,
"color_scheme": "Packages/User/itg.dark (SL).tmTheme",
"draw_indent_guides": true,
"draw_white_space": "all",
"folder_exclude_patterns":
[
".svn",
@torounit
torounit / grid.scss
Created April 2, 2015 07:41
flex grid.
$grid-gutter: 20px !default;
$grid-gutter-small: $grid-gutter !default;
$grid-gutter-medium: $grid-gutter-small !default;
$grid-gutter-large: $grid-gutter-medium !default;
$colslist: 1, 2, 3, 4, 5, 6, 12;
// Media Queries
$screen-small-min: 567px;
$screen-medium-min: 768px;
@torounit
torounit / _ide-helper.php
Created June 18, 2015 04:29
PHPStorm等でWordPressのグローバル変数の入力補完を有効にする。プロジェクトのどこかに置いておくと補完されるようになる。
<?php
trigger_error("This file should not be included, only analyzed by your IDE", E_USER_ERROR);
$wp_the_query = new WP_Query();
/** @var WP_Query $wp_query */
$wp_query = $wp_the_query;
$wp_rewrite = new WP_Rewrite();
$wp = new WP();
@torounit
torounit / Vagrantfile
Created July 2, 2015 06:18
VCCW (https://github.com/vccw-team/vccw) にて、autoconfあたりでこける場合の対処。
# encoding: utf-8
# vim: ft=ruby expandtab shiftwidth=2 tabstop=2
require 'yaml'
Vagrant.require_version '>= 1.5'
Vagrant.configure(2) do |config|
vccw_version = '2.8.2';
@torounit
torounit / gulp-browserify.js
Last active August 29, 2015 14:26
WordPress等で<script>で読み込まれているjQueryとかが居る場合にbrowserifyで上手いことやる。
'use strict';
// ==================================
//
// Config.
//
// ==================================
var config = {
browserify: {
@torounit
torounit / query.php
Last active August 29, 2015 14:27
Bogoの階層アリのカスタム投稿タイプの不具合を修正。
<?php
add_action( 'parse_query', 'bogo_parse_query' );
function bogo_parse_query( $query ) {
$qv = &$query->query_vars;
if ( ! empty( $qv['bogo_suppress_locale_query'] ) )
return;