Skip to content

Instantly share code, notes, and snippets.

@gatespace
Created June 8, 2012 00:35
Show Gist options
  • Save gatespace/2892645 to your computer and use it in GitHub Desktop.
Save gatespace/2892645 to your computer and use it in GitHub Desktop.
WordPressのいろいろなスニペットを詰め込んでおくプラグイン
<?php
/*
Plugin Name: littleflag.com Hacks
Plugin URI:
Description: いろいろなスニペット
Version: 0.1
Author: littleflag.com
Author URI: http://www.littleflag.com/
このプラグインと同じ階層に /lf-func/ というディレクトリを作り、
そこにスニペットを記述したphpファイルを置いておくこと
参考 : http://dogmap.jp/2011/04/19/wordpress-managed-snippet/
*/
$hack_dir = trailingslashit(dirname(__FILE__)) . 'lf-func/';
opendir($hack_dir);
while(($ent = readdir()) !== false) {
if(!is_dir($ent) && strtolower(substr($ent,-4)) == ".php") {
include_once($hack_dir.$ent);
}
}
closedir();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment