1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
function show_breadcrumb($name,$type){ $list = ""; $home = get_bloginfo("home"); if ($type && $name){ $ans = get_term_by('name', $name, $type); $parentID=$ans->parent; while ($parentID > 0){ $parent = get_term_by('id', $parentID, $type); $url = $home."/".$type."/".$parent->slug; $list = "<li><a href='".$url."'>".$parent->name."</a></li>".$list; $parentID = $parent->parent; } $url = $home."/".$type."/".$ans->slug; $list = $list."<li>".$ans->name."</li>"; } if ($list) echo "<ul><li><a href='$home'>Home</a></li>".$list."</ul>"; } |
1 2 3 4 5 |
// Format <?php show_breadcrumb("term-name","taxonomy"); ?> // To list breadcrumbs of "Catalog" taxonomy. <?php show_breadcrumb(single_tag_title("", false),"catalog"); ?> |