Skip to content

Instantly share code, notes, and snippets.

View fumikito's full-sized avatar
🐕
Have 1 dog. Her name is Packing.

Takahashi Fumiki fumikito

🐕
Have 1 dog. Her name is Packing.
View GitHub Profile
@fumikito
fumikito / wp-customize-contactfields.php
Created October 22, 2010 15:40
WordPressのプロフィール編集画面でコンタクトフィールドをカスタマイズする
/**
* Customize contact fields on Profile admin panel
*
* @package WordPress
*/
/**
* WordPressのプロフィール画面に追加するコンタクトメソッド
*
@fumikito
fumikito / include-theme-functions.php
Created April 28, 2011 16:28
WordPressのテーマ内functions.phpが長くなりがちなので、functionsフォルダにファイルを分割して置くとき書いとくと便利
/*
* functionsフォルダにあるファイルをすべて読み込む
*/
foreach(glob(TEMPLATEPATH."/functions/*.php") as $file){
require_once $file;
}
@fumikito
fumikito / detect_attachment_id.php
Created May 6, 2011 08:50
WordPressで画像のURLからアタッチメントIDを取得する
<?php
/**
* 画像のURLからattachemnt_idを取得する
*
*
* @param string $url 画像のURL
* @return int attachment_id
*/
function ri_detect_attachment_id($url){
@fumikito
fumikito / fluid-redmine-badge.js
Created June 2, 2011 13:38
Fluidで作成したRedmineのアプリでドックにバッジを表示するユーザースクリプト
/**
* 自分の担当しているチケットを表示する Window > User Scriptで貼りつける
*
* @return void
*/
function getTicketCount(){
new Ajax.Request("http://tech.hametuha.org/issues.xml", {
method: "get",
parameters: {
key: "Here_comes_your_api_key",
@fumikito
fumikito / nmap-port-scan.bash
Created June 14, 2011 07:26
Nmap ポートスキャン
#Macportsでnmapをインストールすること
nmap -sT 192.168.0.0-255
@fumikito
fumikito / check-deffered-mail.sh
Created June 12, 2012 14:58
Postfixで配信失敗したメールを読む
# http://hatomugi.sakura.ne.jp/forum/topic.php?id=76
#メールキュー確認
mailq
#メールキューのIDで中身を見る
sudo postcat -q [キューID] | nkf -m
@fumikito
fumikito / wp-pagenavi_bootstrap.php
Last active December 12, 2015 16:34
WordPressのWP-Pagenaviが返すHTMLをTwitter Bootstrapに合ったものに変更する
<?php
/**
* Change WP-Pagenavi's output
*
* @package hametuha
* @filter wp_pagenavi
* @param string $html
* @return string
*/
@fumikito
fumikito / single.php
Created December 16, 2015 09:46
Add term meta example
<?php
the_post();
/**
* Get color function.
*
* Get term meta on loop is little bit annoying.
* You should define some wrapper function.
*/
function get_color($tag){
@fumikito
fumikito / get_template_part.php
Created December 21, 2015 03:59
Alternative of WordPress' get_template_part which can accept arguments.
<?php
/**
* A template loader which accepts arguments.
*
* @param string $slug
* @param string|array $name
* @param array $args Arguments to pass.
* @param bool $echo If false, return string.
* @param string $glue Default is '-'. You can specify '/' which means directory separator.
*
@fumikito
fumikito / wp-fulltext-search.php
Created October 19, 2013 17:38
WordPressでFULLTEXTインデックスを用いた全文検索を試す
<?php
/**
* WordPressで全文検索を試みる
*
* initフックなどでインスタンス化してください。
* あんまり遅いタイミングだとエラーを吐きます。
* Singleton実装です。
*
* <code>
* // functions.phpなどに記載