Created
June 8, 2012 00:35
-
-
Save gatespace/2892645 to your computer and use it in GitHub Desktop.
WordPressのいろいろなスニペットを詰め込んでおくプラグイン
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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