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() {
* n5 D8 L8 L8 @/ Z- K& G: _ - $delimiter = '»';
2 [1 n, D. Z6 u - $home = '首頁'; // text for the 'Home' link# ~$ O/ y! `* r+ \" s! d$ h
- $before = '<span class="current">'; // tag before the current crumb
4 y2 u6 S$ E, H- l A - $after = '</span>'; // tag after the current crumb
( }, C3 m- v' L" p - if ( !is_home() && !is_front_page() || is_paged() ) {* C) B8 M6 G3 c6 M* Z
- echo '<div id="crumbs">';, S! O9 o. L( y4 m& v; o
- global $post;+ j0 |9 P( C2 x7 p* [
- $homeLink = get_bloginfo('url');
2 ^8 v- {8 }6 J* R9 c - echo '<a href="' . $homeLink . '">' . $home . '</a> ' . $delimiter . ' ';6 k1 x( Y6 ` |/ C. x% F
- if ( is_category() ) {
& ^1 w, q$ A* t5 U6 M$ O! D" L, n6 g - global $wp_query;
& E( W$ s& s5 b7 I: P - $cat_obj = $wp_query->get_queried_object();' l+ v0 _0 y4 q: m/ }7 E5 s( D
- $thisCat = $cat_obj->term_id;" O, s' [& k1 m3 Z
- $thisCat = get_category($thisCat);0 P- M! S' M3 N& j0 w
- $parentCat = get_category($thisCat->parent);
7 H: G; k @ F& y8 Q - if ($thisCat->parent != 0) echo(get_category_parents($parentCat, TRUE, ' ' . $delimiter . ' '));
/ o. [' n9 p" \+ l& Y% d% }) g - echo $before . ' "' . single_cat_title('', false) . '" 目錄下的文章' . $after;
) r, n. j" ` c# W# b - } else if ( is_single() && !is_attachment() ) {
+ w) H X# }, B$ u8 s( K - if ( get_post_type() != 'post' ) {
* w2 t4 t3 A4 A - $post_type = get_post_type_object(get_post_type());" e/ ~' B: F2 l1 G3 L3 a7 O# b
- $slug = $post_type->rewrite;' S: |9 m3 \5 |* F! K% X
- echo '<a href="' . $homeLink . '/' . $slug['slug'] . '/">' . $post_type->labels->singular_name . '</a> ' . $delimiter . ' ';
8 p: R: k. N; k - echo $before . get_the_title() . $after;8 l/ }" t, U( F g0 \2 V' N/ c6 x
- } else {; W/ I# g) w% ^4 G
- $cat = get_the_category(); $cat = $cat[0];
Z! ]7 V% T4 h4 z5 p3 Y - echo get_category_parents($cat, TRUE, ' ' . $delimiter . ' ');
* {/ p9 S" R+ k+ b" N3 X - echo $before . get_the_title() . $after;
8 ]. ^: E7 [3 Q8 B- [2 o% V2 S6 u# u - }
9 R# M9 W/ X: X7 a - } else if ( !is_single() && !is_page() && get_post_type() != 'post' ) {
/ s4 t; }- K/ x+ Y& F3 V" A - $post_type = get_post_type_object(get_post_type());
3 R8 D! J0 {; K% l - echo $before . $post_type->labels->singular_name . $after;
% l/ L, D* j" D* o/ {' ~7 A2 ^7 V - }& E! I0 g% ]* [ B( [+ `$ C
- if ( get_query_var('paged') ) {9 Y. f" K; K) b; s0 g; r
- if ( is_category() || is_day() || is_month() || is_year() || is_search() || is_tag() || is_author() ) echo ' (';* P# P) Y: g9 t* l
- echo __('Page') . ' ' . get_query_var('paged');
. Y4 }. i k6 e2 Q - if ( is_category() || is_day() || is_month() || is_year() || is_search() || is_tag() || is_author() ) echo ')';: t. k* z5 K9 R# @" l1 m
- }
1 S! z8 {6 z) ] - echo '</div>';' w5 Y- J- n7 ^+ D. Z* I
- }
複製代碼 然後在你要用麵包屑導航的地方添加(比如正文標題下面)- <?php if (function_exists( 'fairy_breadcrumbs')) fairy_breadcrumbs(); ?>
複製代碼
: I- f4 f$ C" n8 M7 b, C$ o, M |