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() {
9 g# i/ o( A2 \ i - $delimiter = '»';7 {8 d% b. [- F' i/ t* U" d
- $home = '首頁'; // text for the 'Home' link
0 ~: r: g0 P7 P! q8 @ - $before = '<span class="current">'; // tag before the current crumb7 k) [ }8 J& a" S4 R
- $after = '</span>'; // tag after the current crumb8 _, a8 U' P" Y3 G
- if ( !is_home() && !is_front_page() || is_paged() ) {
" G6 b& F, D. M @) T# b9 Z4 _ - echo '<div id="crumbs">';; W* t' S; k9 m; n3 \
- global $post;
9 N, O3 f) v) o W# D7 S" S# c. t - $homeLink = get_bloginfo('url');
0 g* J5 ]5 o% m" P, H - echo '<a href="' . $homeLink . '">' . $home . '</a> ' . $delimiter . ' ';" y! u# I- U/ [
- if ( is_category() ) {2 }' p& y" t, C# z
- global $wp_query;
# Q2 G( Q0 J6 m3 [; k2 W/ v+ D - $cat_obj = $wp_query->get_queried_object();
1 p1 W3 r8 T9 t c# | }% }* i - $thisCat = $cat_obj->term_id;
. E' Y' `) L! ]2 x A - $thisCat = get_category($thisCat);" g3 R5 ~7 O) _8 z% e( o0 v
- $parentCat = get_category($thisCat->parent);! K/ ^3 r( \2 O% @+ t- k- `, d
- if ($thisCat->parent != 0) echo(get_category_parents($parentCat, TRUE, ' ' . $delimiter . ' '));
: |- y9 t0 V" }% y% C5 ^) y/ Y4 R. q - echo $before . ' "' . single_cat_title('', false) . '" 目錄下的文章' . $after;
$ z. g- H3 f" R- [) A# h - } else if ( is_single() && !is_attachment() ) {
. B2 H2 H c+ @' _* Y9 K5 O - if ( get_post_type() != 'post' ) {
" l2 w8 x6 M4 r% x: @/ y - $post_type = get_post_type_object(get_post_type());
# l8 T# e# X& r- [5 g: j; y - $slug = $post_type->rewrite;; {- }! e6 ?, _" d& B- W1 `: ~
- echo '<a href="' . $homeLink . '/' . $slug['slug'] . '/">' . $post_type->labels->singular_name . '</a> ' . $delimiter . ' ';& y1 a: Y& A6 e
- echo $before . get_the_title() . $after;
. A8 a- z/ p1 j( E- C - } else {
8 E; ]# c+ h7 o) a1 f - $cat = get_the_category(); $cat = $cat[0];# I1 f7 w1 g8 v7 S) ^4 b% E
- echo get_category_parents($cat, TRUE, ' ' . $delimiter . ' ');
: f7 _4 D6 J; p- J( k" S) ^ - echo $before . get_the_title() . $after;; j4 v" L3 S' n6 w! y
- }
0 V! o- Z) H( [( }2 U) R n/ D) v - } else if ( !is_single() && !is_page() && get_post_type() != 'post' ) {
$ y5 _* t' w" ]; `! P, W - $post_type = get_post_type_object(get_post_type());' D# G g4 ~% r" ]9 E5 P' L
- echo $before . $post_type->labels->singular_name . $after;
; x' ^% \2 [8 s! M - }
3 l p: Z% ^$ l0 C2 D3 P - if ( get_query_var('paged') ) {7 r: {/ x+ V5 z% L: P9 M2 N7 G
- if ( is_category() || is_day() || is_month() || is_year() || is_search() || is_tag() || is_author() ) echo ' (';
3 r4 ?1 E6 U$ ? - echo __('Page') . ' ' . get_query_var('paged');
) A: Y" E, W: t5 M8 E( C& @( ] - if ( is_category() || is_day() || is_month() || is_year() || is_search() || is_tag() || is_author() ) echo ')';8 M; P1 b8 C \' F% c9 A
- }
" S; o- ^, ^& b0 E& y1 M - echo '</div>';
; R! s4 ~7 M- _$ |& t2 Y1 r( k - }
複製代碼 然後在你要用麵包屑導航的地方添加(比如正文標題下面)- <?php if (function_exists( 'fairy_breadcrumbs')) fairy_breadcrumbs(); ?>
複製代碼
8 ^' k& o4 Q$ S' R9 x8 O- x7 r |