Skip to content

Instantly share code, notes, and snippets.

@yokotak0527
yokotak0527 / gist:2834564
Created May 30, 2012 08:36
wordpressでエントリーのルートカテゴリーを取得する
//ex -> the_root_category(get_the_category(),"span");
function the_root_category($cat,$mode="li"){
$cat = get_root_category($cat);
$cnt = count($cat);
$_cat;
for($i = 0;$i<$cnt;$i++){
echo "<".$mode." class='catGroup catGroup".$i." ".$cat[$i]->slug."'>".$cat[$i]->name."</".$mode.">";
}
};
@yokotak0527
yokotak0527 / gist:888852
Created March 27, 2011 02:13
design pattern
//
// singleton pattern
//
var Singleton = (function(){
var instance;
return function(){
if(instance){
return instance;
};