Skip to content

Instantly share code, notes, and snippets.

View tekapo's full-sized avatar

Tai / JOTAKI Taisuke tekapo

View GitHub Profile
@gatespace
gatespace / gist:4108710
Created November 19, 2012 02:52 — forked from tekapo/gist:4108697
最強のテンプレートタグ get_the_khoshino()
<?php
function get_the_khoshino($username == null) {
if (!empty($username)) {
return 'いやいや'.$username.'さんほどでは。';
} else {
return 'やはりですか。なるほどですね。';
}
}
?>
@hissy
hissy / gist:4116825
Last active October 13, 2015 01:18
[WordPress] Override Loading Template
<?php
/**
* This is a example: force to use index.php at tag archive
*/
function my_template_include($template){
if ( is_tag() ) {
$template = get_index_template();
}
return $template;
}
@wokamoto
wokamoto / gist:5994354
Created July 14, 2013 13:53
White Ale Coriander Special PHAK CHEE MASHI2
モルト
2-ROW 10,400g
WHEAT MALT 3,900g
ホップ
1st
チヌーク 15g
3rd
ストリアンゴールディング 30g
カスケード 25g
export PS1="[\u@\h \W]\\$ "
HISTIGNORE=rm\ *
alias vi="vim"
alias delmacfile="find . -name \".DS_Store\" -exec rm -f {} \;"
alias ql='qlmanage -p "$@" >& /dev/null'
alias svndel="svn st | grep '^!' | sed -e 's/\![ ]*/svn del /g' | sh"
alias svnadd="svn st | grep '^?' | sed -e 's/\?[ ]*/svn add /g' | sh"
alias yuicomp="/usr/local/bin/yuicompressor --charset UTF-8 -o"
<?php
/*
Plugin Name: must use functions.
Plugin URI:
Description:
Version: 0.1
Author: DigitalCube
Author URI:
License: GPLv2 or later
*/
@miya0001
miya0001 / hatamoto.php
Last active May 21, 2019 05:28
汎用的な管理画面付きのWordPressプラグインのテンプレート
<?php
/**
* Plugin Name: Hatamoto
* Plugin URI: https://wpist.me/
* Description: This is a awesome cool plugin.
* Version: 0.1.0
* Author: Takayuki Miyauchi
* Author URI: https://wpist.me/
* License: GPLv2
* Text Domain: hatamoto
@torounit
torounit / useMeta.js
Last active September 1, 2020 03:28
useState 風味に WordPressのカスタムフィールドを扱うやつ
import { Fragment, useCallback } from '@wordpress/element';
import { useDispatch, useSelect } from '@wordpress/data';
const useMeta = ( key ) => {
const meta = useSelect( ( select ) => {
const { getEditedPostAttribute } = select( 'core/editor' );
const values = getEditedPostAttribute( 'meta' ) || {};
return values[ key ] || '';
}, [] );
@jonathonbyrdziak
jonathonbyrdziak / example.php
Created February 22, 2012 02:27
Wordpress Metabox, stand alone class for multiple metabox abilities
<?php
/*
Here's a couple of metaboxes that I've recently created using this system
*/
$subpostings = redrokk_metabox_class::getInstance('subpostings', array(
'title' => '(optional) Subscription for Postings',
'description' => "As an optional feature, you have a complete api at your disposal which will allow you the ability to offer and manage member posts. In addition to these settings, you may need to create the associated pages for accepting posts from your frontend.",
@markjaquith
markjaquith / disable-plugins-when-doing-local-dev.php
Created June 24, 2011 10:24
Disables specified WordPress plugins when doing local development
<?php
/*
Plugin Name: Disable plugins when doing local dev
Description: If the WP_LOCAL_DEV constant is true, disables plugins that you specify
Version: 0.1
License: GPL version 2 or any later version
Author: Mark Jaquith
Author URI: http://coveredwebservices.com/
*/
@gatespace
gatespace / view_template_files.php
Last active July 30, 2022 22:04
WordPressのテーマにおいて、テンプレート階層に基づきどのテンプレートファイルが使われているか書き出すコード。 WordPressがデバッグモードのときのみ表示します。 使っているテンプレートファイルはグローバル変数 $template に保存されています。 (ただし、header.php や get_template_part などでインクルードされているファイルを除く) wp_footerにフックする形で関数が実行されますので、テーマのfunctions.phpの適当な箇所に追記してください。
/*
WordPressのテーマにおいて、テンプレート階層に基づきどのテンプレートファイルが使われているか書き出すコード。
ただし、header.php や get_template_part などでインクルードされているファイルを除く。
*/
add_action('wp_footer', 'view_template_files');
if ( !function_exists( 'view_template_files' ) ):
function view_template_files() {
if ( defined('WP_DEBUG') && WP_DEBUG ) {
global $template;