第一步:
如果是RiPro主题,请在后台顶部设置添加自定义CSS。
/*文章标题优化*/ .sjblog-avatar { width: 50px; float: left; } .sjblog-avatar img { float: left; width: 50px; border-radius: 50%; margin-right: 20px; } .sjblog-tgroup{ padding-left: 66px; padding-bottom: 20px; border-bottom: 1px solid #f5f5f5; margin-bottom: 20px; } .article-content .entry-header .entry-title{ padding-bottom:0; margin-bottom: 0; border-bottom: none; } .sjblog-name { display: block; font-size: 13px; color: #cdcdcd; } .sjblog-name a{ color: #cdcdcd; } .sjblog-name a:hover{ color: #2756fc; } .sjblog-time { margin-left: 20px; }
第二步:打开wp-content/themes/ripro/parts,找到文件“single-header.php”编辑修改成以下代码:
<div class="cao_entry_header"> <div class="sjblog-avatar"> <?php echo get_avatar( get_the_author_meta( 'email' ), '96', null, get_the_author_meta( 'display_name' ) ); ?> </div> <div class="sjblog-tgroup"> <?php edit_post_link('[编辑]'); ?> <?php if ( ! is_page() ) { cao_entry_header( array( 'tag' => 'h1') ); } else { cao_entry_header( array( 'tag' => 'h1', 'link' => false ) ); } get_template_part( 'parts/entry-subheading' ); ?> <header class="entry-header"> <span class="sjblog-name">作者: <a href="<?php echo esc_url( get_author_posts_url( get_the_author_meta( 'ID', $author_id ) ) ); ?>" rel="external nofollow" ><?php the_author(); ?></a> <span class="sjblog-time"> 发布时间: <i class="fa fa-clock-o"></i> <?php echo the_time('Y-m-j'); ?></span> <span class="sjblog-views"> <?php echo '<i class="fa fa-eye"></i> '._get_post_views();?> </span> 人阅读</span> </div> </div>