wordpressでパンくずを付けるプラグインもあるけど、出来ればコードでスマートにすませたいのです。
ということでメモ。
胃が痛い。
まずは
<?php
function the_breadcrumb() {
if (!is_home()) {
echo '<a href="';
echo get_option('home');
echo '">';
bloginfo('name');
echo "</a> » ";
if (is_category() || is_single()) {
the_category(',');
if (is_single()) {
echo " » ";
the_title();
}
} elseif (is_page()) {
echo the_title();
}
}
}
?>
パンくずを載せたいところ(single.phpとか)に下記を追加。
<?php the_breadcrumb(); ?>
簡単ー!
参考サイト:How To: Breadcrumb Function For WordPress
1 Response to パンくずを付けるコード – wordpress
Tweets that mention パンくずを付けるコード – wordpress | MMB -- Topsy.com
7月 23rd, 2010 at 2:50 AM
[...] This post was mentioned on Twitter by WordPressボット日本語版, ã*®ã*¶. ã*®ã*¶ said: パンくずを付けるコード – wordpress http://ow.ly/2f5eS [...]