1、在the_content( ) 裡修改:- <?php the_content('<img src="http://XXX.com/read-more.png" alt="Arrow" title="Read more" />'); ?>
複製代碼 2、在function.php文件裡添加這段代碼:- function fairy_breadcrumbs() {
3 o2 z1 C2 { M. p* R - $delimiter = '»';: f E" H: ?0 p9 B5 _+ j
- $home = '首頁'; // text for the 'Home' link/ g, ?) ?5 p$ q; k
- $before = '<span class="current">'; // tag before the current crumb8 `, a* q$ ~! R6 I
- $after = '</span>'; // tag after the current crumb0 d) F% t, n1 A9 _: y+ ^' ~
- if ( !is_home() && !is_front_page() || is_paged() ) {
8 P5 `5 B* F0 I: u - echo '<div id="crumbs">';
+ ]- G$ h) t/ j9 I; C$ h, m+ ~ - global $post;
7 [( J, t5 {& F+ v - $homeLink = get_bloginfo('url');
/ @; D+ M( o* A) K, p - echo '<a href="' . $homeLink . '">' . $home . '</a> ' . $delimiter . ' ';
6 U( ^, W* Y4 p2 z$ ] - if ( is_category() ) {$ m8 R6 N% }3 `& U6 V8 ^' R7 m9 [. d
- global $wp_query;) G7 C, G' \+ H
- $cat_obj = $wp_query->get_queried_object();
9 a& k) N8 l' R8 J7 c - $thisCat = $cat_obj->term_id;
! g7 z3 i/ n \& ?( L - $thisCat = get_category($thisCat);
+ W6 d: l% n+ x' t - $parentCat = get_category($thisCat->parent); o4 W/ W# J* }( }
- if ($thisCat->parent != 0) echo(get_category_parents($parentCat, TRUE, ' ' . $delimiter . ' '));
) ~$ y1 t9 w5 e) _ x - echo $before . ' "' . single_cat_title('', false) . '" 目錄下的文章' . $after;- q @! X. ?9 l+ w. U" S; J) z7 m; C
- } else if ( is_single() && !is_attachment() ) {, ~ v! t" P9 ?3 Z' R& U" Y
- if ( get_post_type() != 'post' ) {" d: P7 m4 M# X% Q$ C
- $post_type = get_post_type_object(get_post_type());$ G& h+ _1 L# @8 T+ N4 K7 {
- $slug = $post_type->rewrite;
9 A# x/ D) r$ b! H/ z2 ? - echo '<a href="' . $homeLink . '/' . $slug['slug'] . '/">' . $post_type->labels->singular_name . '</a> ' . $delimiter . ' ';
; o F+ [" ?8 K0 B4 j4 Z - echo $before . get_the_title() . $after;
* R' L+ T A8 t, A+ j. X- I - } else {- X: l" \7 O" O6 g" ?3 ?/ s
- $cat = get_the_category(); $cat = $cat[0];6 l# \! V! }" w
- echo get_category_parents($cat, TRUE, ' ' . $delimiter . ' ');' X# [0 H8 K p
- echo $before . get_the_title() . $after;
+ z$ U4 b+ B/ @3 g3 o/ p9 O* u - }
$ p. A |. S& f - } else if ( !is_single() && !is_page() && get_post_type() != 'post' ) {; y# B, N) }0 {6 w6 t/ \# R, ^
- $post_type = get_post_type_object(get_post_type());
8 i3 p& A7 ]1 S2 ]0 z - echo $before . $post_type->labels->singular_name . $after; ^" S& c/ J+ e6 \
- }9 L7 k2 e# u+ s* q, K# f: k
- if ( get_query_var('paged') ) {0 Z, Q% V* E2 z1 U
- if ( is_category() || is_day() || is_month() || is_year() || is_search() || is_tag() || is_author() ) echo ' (';+ E( M8 r @2 L' t, h# Q: c+ x
- echo __('Page') . ' ' . get_query_var('paged');- s9 {1 y5 F8 x" W
- if ( is_category() || is_day() || is_month() || is_year() || is_search() || is_tag() || is_author() ) echo ')';
3 g3 g5 K* q: s$ B* S9 O - }3 K6 K a5 l/ _, Z9 m/ X
- echo '</div>';
# f t$ V5 S. U, A) z8 Z - }
複製代碼 然後在你要用麵包屑導航的地方添加(比如正文標題下面)- <?php if (function_exists( 'fairy_breadcrumbs')) fairy_breadcrumbs(); ?>
複製代碼
6 C, c' S) o+ B! a/ ^+ [; d |