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() {
! q* B7 ~0 |3 n" x. d/ y7 K - $delimiter = '»';1 x f& _6 P5 _+ B. R8 `7 O+ w
- $home = '首頁'; // text for the 'Home' link5 I. O U; M- c4 `
- $before = '<span class="current">'; // tag before the current crumb
* T3 a# l6 b* q y - $after = '</span>'; // tag after the current crumb. \+ j7 d! i& c( p
- if ( !is_home() && !is_front_page() || is_paged() ) {+ G9 }$ a! O$ h" z3 Z
- echo '<div id="crumbs">';
: v9 j; v0 g' ~2 ^& Y+ A - global $post;
2 V( l3 T C- Q/ ], y. [ - $homeLink = get_bloginfo('url');
& D8 B3 `: `4 p% A% m: V - echo '<a href="' . $homeLink . '">' . $home . '</a> ' . $delimiter . ' ';
% ]& v& u3 L% R' N - if ( is_category() ) {
9 R. m* Q; g9 X$ Z% D - global $wp_query;7 A2 j+ _& l* q0 B0 N4 G( b
- $cat_obj = $wp_query->get_queried_object();
5 m- T$ P" a+ M. B7 F2 C3 ~ - $thisCat = $cat_obj->term_id;
2 U: H7 h# a" m( c+ w - $thisCat = get_category($thisCat);
5 v5 |% I8 |1 E" {# } - $parentCat = get_category($thisCat->parent);
5 R3 B+ ~; S2 }' m$ ^ - if ($thisCat->parent != 0) echo(get_category_parents($parentCat, TRUE, ' ' . $delimiter . ' '));
: h+ R% y) y' G! O1 E% h! m - echo $before . ' "' . single_cat_title('', false) . '" 目錄下的文章' . $after;. Q: x1 S) r B6 C
- } else if ( is_single() && !is_attachment() ) {7 u& V) {; `5 ?, V' v+ l. _, L
- if ( get_post_type() != 'post' ) {
, M# x' L% T- Q, M% W - $post_type = get_post_type_object(get_post_type());& d) w& W A' @/ Q8 A' k
- $slug = $post_type->rewrite;
! u7 P0 I D& L# g - echo '<a href="' . $homeLink . '/' . $slug['slug'] . '/">' . $post_type->labels->singular_name . '</a> ' . $delimiter . ' ';
4 R! i1 A/ U# @( x5 I4 p3 g) K9 ` - echo $before . get_the_title() . $after;
% {* u# B6 L+ ~. g% u - } else {: ~( ]6 \( A. p* o' I& K
- $cat = get_the_category(); $cat = $cat[0];3 L' U2 T/ \, M+ \+ x9 w/ o
- echo get_category_parents($cat, TRUE, ' ' . $delimiter . ' ');
' @7 Z* u; N5 a* l. e, k - echo $before . get_the_title() . $after;7 i; D" K7 v4 T, G) X/ L
- }& h4 l3 f1 i0 f* k: k
- } else if ( !is_single() && !is_page() && get_post_type() != 'post' ) {: a/ `" W7 ~* l' z
- $post_type = get_post_type_object(get_post_type());+ N0 _8 c4 D- t) t( }! o+ f
- echo $before . $post_type->labels->singular_name . $after;
O; U5 L% ^$ o - }9 c5 r& q1 H/ V" [5 k
- if ( get_query_var('paged') ) {$ Z, g" \- s: X4 j& H3 f
- if ( is_category() || is_day() || is_month() || is_year() || is_search() || is_tag() || is_author() ) echo ' (';
/ b1 e* `, V7 ?0 ~& h$ b: @* c - echo __('Page') . ' ' . get_query_var('paged');
, `! `9 D0 y! Z# R8 p: P3 Y0 I: F - if ( is_category() || is_day() || is_month() || is_year() || is_search() || is_tag() || is_author() ) echo ')';5 N0 w9 M, Q& a5 b" t, U2 m( n# Y2 J
- }
. n' t J) l) b - echo '</div>';
5 B6 o: T: F/ F) P - }
複製代碼 然後在你要用麵包屑導航的地方添加(比如正文標題下面)- <?php if (function_exists( 'fairy_breadcrumbs')) fairy_breadcrumbs(); ?>
複製代碼
6 {) [2 `8 g# k6 X |