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() {
) F3 T. Q% h/ w. ]2 t4 [ - $delimiter = '»';* S7 @ ]: J' W v/ g% c) }1 q
- $home = '首頁'; // text for the 'Home' link6 J/ D K* q$ y/ Y. M
- $before = '<span class="current">'; // tag before the current crumb# N% p/ L4 `4 `- s7 Z- o% o7 X5 Y
- $after = '</span>'; // tag after the current crumb
% B( I( C! |7 ?8 V - if ( !is_home() && !is_front_page() || is_paged() ) {) a4 F( Z+ B' x; f- Y$ y% b
- echo '<div id="crumbs">';
+ H3 [6 l" G9 O) n - global $post;
% g$ |& Q0 N" S) _ - $homeLink = get_bloginfo('url');
( `0 P# z% [% j' T. | - echo '<a href="' . $homeLink . '">' . $home . '</a> ' . $delimiter . ' ';4 g* \" D8 p9 w$ ]8 ]
- if ( is_category() ) {
' Q# _& I1 n. |& `( t" ^ - global $wp_query;5 N+ E, x0 A2 |, _6 Q: F
- $cat_obj = $wp_query->get_queried_object();/ \- U' e5 Y/ `) }- p6 _& J# o. ]' d
- $thisCat = $cat_obj->term_id;
' Z1 w# D) k4 p6 T: K - $thisCat = get_category($thisCat);
! y8 n& `2 H+ E& W# l0 t - $parentCat = get_category($thisCat->parent);
6 s( S {& Y8 e0 e# u% [0 l% V0 L5 {9 K% Q - if ($thisCat->parent != 0) echo(get_category_parents($parentCat, TRUE, ' ' . $delimiter . ' ')); ^7 T1 }0 \8 E
- echo $before . ' "' . single_cat_title('', false) . '" 目錄下的文章' . $after;
* n. D1 q% ]8 U( ^ - } else if ( is_single() && !is_attachment() ) {
& A8 V5 d& J8 v3 h' x - if ( get_post_type() != 'post' ) {
* Q Q6 Z; _: a! |3 b/ a7 @ - $post_type = get_post_type_object(get_post_type());
: T( \/ `7 R, z2 E - $slug = $post_type->rewrite;' m2 V' _: R1 K' N) Y0 Y& w
- echo '<a href="' . $homeLink . '/' . $slug['slug'] . '/">' . $post_type->labels->singular_name . '</a> ' . $delimiter . ' ';, I2 l& v/ d! |3 j
- echo $before . get_the_title() . $after;
( Y' F0 } o+ {0 G7 k7 P& | - } else {
1 V Z) @# e0 a0 J- A - $cat = get_the_category(); $cat = $cat[0];) g; T' B' N3 ]
- echo get_category_parents($cat, TRUE, ' ' . $delimiter . ' ');1 `- C8 I7 { Y
- echo $before . get_the_title() . $after;: {; p+ {( }7 T
- }
) y! t% L( [% y - } else if ( !is_single() && !is_page() && get_post_type() != 'post' ) {8 D' u8 f0 M' b
- $post_type = get_post_type_object(get_post_type());
' j7 z: ^2 B$ } _5 G7 W7 S' S - echo $before . $post_type->labels->singular_name . $after;
& Q# u' W- y/ ^, n; p - }
2 T$ r8 L7 C4 z5 j( Q6 d3 g% |3 Z - if ( get_query_var('paged') ) {! C0 D8 X) c3 ?8 V( U/ l& q
- if ( is_category() || is_day() || is_month() || is_year() || is_search() || is_tag() || is_author() ) echo ' (';2 z1 W% S" X4 |* _! q
- echo __('Page') . ' ' . get_query_var('paged');4 E7 S) y; m. {5 K) @$ S: W
- if ( is_category() || is_day() || is_month() || is_year() || is_search() || is_tag() || is_author() ) echo ')';$ s5 z3 x, \* O7 g8 \/ M. G# t9 b
- }; P9 ^* U, ]: _# [0 x% I
- echo '</div>';% f+ W, U( I4 h! a& p- c% _
- }
複製代碼 然後在你要用麵包屑導航的地方添加(比如正文標題下面)- <?php if (function_exists( 'fairy_breadcrumbs')) fairy_breadcrumbs(); ?>
複製代碼
" @8 n* G/ k& C) ? |