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() {5 D0 i9 V! C4 H7 t$ j$ H
- $delimiter = '»';
P) B# n4 k' _/ G$ I' ]' J2 J - $home = '首頁'; // text for the 'Home' link
e( ]- A' A" h - $before = '<span class="current">'; // tag before the current crumb
" K h' I/ X) @ r' |* _ - $after = '</span>'; // tag after the current crumb
# K1 u/ q8 A* a - if ( !is_home() && !is_front_page() || is_paged() ) {' L+ L! y j1 k. V0 K6 s& O" D
- echo '<div id="crumbs">';* R: w9 U; t( J0 G3 ? k
- global $post;
" G* y: G2 V. N2 @ - $homeLink = get_bloginfo('url');
6 ], { S' _. g* }0 d/ W/ |% F& Z - echo '<a href="' . $homeLink . '">' . $home . '</a> ' . $delimiter . ' ';
5 T0 Z7 H \6 r - if ( is_category() ) {- [- h8 ^$ z; h' t, i; O0 l
- global $wp_query;
* l2 k* Y- H7 g1 D$ s' j& _0 _9 { - $cat_obj = $wp_query->get_queried_object();
* z7 Z' L5 [$ }1 _ - $thisCat = $cat_obj->term_id;1 @& G& Z# \" H
- $thisCat = get_category($thisCat);
' k( K R% z2 Q& V: C, H- s - $parentCat = get_category($thisCat->parent);
: j: a+ N: }2 B- B" z1 r" ~: E# a' \2 j - if ($thisCat->parent != 0) echo(get_category_parents($parentCat, TRUE, ' ' . $delimiter . ' '));) ?6 ^9 {# j/ b5 e" J
- echo $before . ' "' . single_cat_title('', false) . '" 目錄下的文章' . $after;8 f, T; z- u( i) O& o
- } else if ( is_single() && !is_attachment() ) {
% t' ^' P( t4 S# s O) h - if ( get_post_type() != 'post' ) {
* f" t9 S, ]0 o( q$ F - $post_type = get_post_type_object(get_post_type());
4 |! J3 K9 X+ [! t P' Y# ?! T2 G - $slug = $post_type->rewrite;
$ [6 `2 x' _) t5 e; U# _' q) H' h" }' @# [ - echo '<a href="' . $homeLink . '/' . $slug['slug'] . '/">' . $post_type->labels->singular_name . '</a> ' . $delimiter . ' ';
- G3 S' \% \% _( R. h0 |5 Y/ X - echo $before . get_the_title() . $after;& Y. z$ S, F# t: U8 y" \
- } else {! v. U. |' d% O1 R& _ P
- $cat = get_the_category(); $cat = $cat[0];
7 F) S. B: |- i& X - echo get_category_parents($cat, TRUE, ' ' . $delimiter . ' ');! ~, p2 r: T& C* I# w; L3 F' |
- echo $before . get_the_title() . $after;
. s$ G/ n5 }: g4 N. \% D4 I - }
* [6 u# ]6 s0 |; p0 O6 B - } else if ( !is_single() && !is_page() && get_post_type() != 'post' ) {5 F5 K- p5 o6 g
- $post_type = get_post_type_object(get_post_type());
% I/ D( J; i: G) B7 T - echo $before . $post_type->labels->singular_name . $after;
6 k2 B: {, A1 U& K, }7 b - }
: Y! |8 I8 j& u( { - if ( get_query_var('paged') ) {- U/ t2 l2 T4 O0 h4 W
- if ( is_category() || is_day() || is_month() || is_year() || is_search() || is_tag() || is_author() ) echo ' (';
" D9 e6 n. a8 i0 H# B: i/ y* G - echo __('Page') . ' ' . get_query_var('paged');
2 Y' u& D! o6 {7 @7 ^! C8 K5 f - if ( is_category() || is_day() || is_month() || is_year() || is_search() || is_tag() || is_author() ) echo ')';
( y5 C+ `7 U& U* C/ J9 M& _! _/ \ - }5 }! |4 d1 P& o8 ?# ^
- echo '</div>';
3 x' l. d+ K' N% E7 Y% e/ c - }
複製代碼 然後在你要用麵包屑導航的地方添加(比如正文標題下面)- <?php if (function_exists( 'fairy_breadcrumbs')) fairy_breadcrumbs(); ?>
複製代碼 # T8 D# T1 C% O1 I" R
|