有的wordpress主題模版則沒有。找到一個Breadcrumb Navigation麵包屑導航的代碼。分享一下。。。/ U C- g/ p% B- w
4 ^5 l: d% h5 I: o8 Q: U" n( \
0 b9 X$ T, ~, D3 _1、修改主題的functions.php文件中添加下面這段代碼:- # Breadcrumb
& X6 q8 h: {1 ?& q& F - function the_breadcrumb() {! ^6 Q* A6 m" ]* B/ k; J& B
- if (!is_home()) {/ r7 y9 `5 @* P, V1 N5 X# H! J: y4 p
- echo '<a href="';% [4 q# d* ~5 R
- echo get_option('home');
. p4 W9 R4 [ n" ^! H! o - echo '">';
8 @9 Z& J/ S: A; ? - echo "Home"; p2 W) r3 b' a5 Z3 F
- echo "</a> » ";/ \: w; t9 {, u9 S! ]2 v5 H; _
- if (is_category() || is_single()) {
" @0 e8 Y$ `: Z2 }' ] - single_cat_title();
! w3 T! | [+ f7 i2 I9 T7 P - if (is_single()) {
& K% d q& l$ b4 m - the_category(', ');
+ u% m. ?( y1 Z - echo " » ";
h! G. P o9 c3 o& G - the_title();
$ {6 Y8 {0 [9 c1 D2 g8 ]9 e - }
9 k4 I4 g0 F% A6 H E - } elseif (is_page()) {, A* g3 T2 M. g, [
- echo the_title();
9 c: V6 F" W* n, [' _* V - }' M& j% K' e& g0 E1 P' S# H% j: |
- elseif (is_tag()) {
+ m6 V. F2 u1 M5 g* Z - echo 'Posts tagged with "';
1 ~3 k/ x J) f6 y1 _8 M - single_tag_title();
4 y V% ~4 V! q( q1 ` - echo '"'; }* I2 |; w# l; X2 R( C0 J/ l& v
- elseif (is_day()) {echo "Archive for "; the_time(' F jS, Y');}
; u" e, a, i) C+ F9 e ? - elseif (is_month()) {echo "Archive for "; the_time(' F, Y');}
; U9 H% q) p6 L4 J: Y) I3 } - elseif (is_year()) {echo "Archive for "; the_time(' Y');}
8 W8 |2 `' Z$ c7 v - elseif (is_author()) {echo "Author Archive";}
: S8 A! W9 r9 [: e! W& V* v - elseif (isset($_GET['paged']) && !empty($_GET['paged'])) {echo "Blog Archives";}; a/ D ]1 t) W' _" }! `
- elseif (is_search()) {echo "Search Results";}; i+ q, G3 B! z8 X
- }
5 Y, g2 m1 l% t; ~- p6 W/ I - }
& _9 h0 T+ W* D6 A
複製代碼 2、在頁面模板(category.php或single.php等)適當地方插入這一行:- <?php
5 J( P! I9 S! \0 w6 F) c - the_breadcrumb();. R w# k/ ]- m6 k) v) `# B
- ?>. {" _+ v# V0 p n- n
複製代碼 |
|