|
发表于 2013-11-7 09:44:31
|
显示全部楼层
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() {
- $delimiter = '»';
- $home = '首页'; // text for the 'Home' link
- $before = '<span class="current">'; // tag before the current crumb
- $after = '</span>'; // tag after the current crumb
- if ( !is_home() && !is_front_page() || is_paged() ) {
- echo '<div id="crumbs">';
- global $post;
- $homeLink = get_bloginfo('url');
- echo '<a href="' . $homeLink . '">' . $home . '</a> ' . $delimiter . ' ';
- if ( is_category() ) {
- global $wp_query;
- $cat_obj = $wp_query->get_queried_object();
- $thisCat = $cat_obj->term_id;
- $thisCat = get_category($thisCat);
- $parentCat = get_category($thisCat->parent);
- if ($thisCat->parent != 0) echo(get_category_parents($parentCat, TRUE, ' ' . $delimiter . ' '));
- echo $before . ' "' . single_cat_title('', false) . '" 目录下的文章' . $after;
- } else if ( is_single() && !is_attachment() ) {
- if ( get_post_type() != 'post' ) {
- $post_type = get_post_type_object(get_post_type());
- $slug = $post_type->rewrite;
- echo '<a href="' . $homeLink . '/' . $slug['slug'] . '/">' . $post_type->labels->singular_name . '</a> ' . $delimiter . ' ';
- echo $before . get_the_title() . $after;
- } else {
- $cat = get_the_category(); $cat = $cat[0];
- echo get_category_parents($cat, TRUE, ' ' . $delimiter . ' ');
- echo $before . get_the_title() . $after;
- }
- } else if ( !is_single() && !is_page() && get_post_type() != 'post' ) {
- $post_type = get_post_type_object(get_post_type());
- echo $before . $post_type->labels->singular_name . $after;
- }
- if ( get_query_var('paged') ) {
- if ( is_category() || is_day() || is_month() || is_year() || is_search() || is_tag() || is_author() ) echo ' (';
- echo __('Page') . ' ' . get_query_var('paged');
- if ( is_category() || is_day() || is_month() || is_year() || is_search() || is_tag() || is_author() ) echo ')';
- }
- echo '</div>';
- }
复制代码 然后在你要用面包屑导航的地方添加(比如正文标题下面)- <?php if (function_exists( 'fairy_breadcrumbs')) fairy_breadcrumbs(); ?>
复制代码
|
评分
-
查看全部评分
|