||
在看别人Wordpress博客的时候发现文章后面会有两行文字,说转载请注明转载自*****,原文链接****,虽然不能阻止别人无条件转载自己的文章,不过加上去总能起点警示作用。同时也是能提高读者的版权意识。这个其实很简单,只要在single.php里加几行代码就行了。
找到single.php里找到显示文章的那一行。这里我选择的是将版权信息放在文章里面。即<div class="entry clearfix"></div>这两个标签之间。
所以,在以下这段代码之后:
if($theme->display_a('thumbnail', $get_post_elements) && has_post_thumbnail()) {
the_post_thumbnail(
array($theme->get_option('singlepost_thumbnail_width'), $theme-
>get_option('singlepost_thumbnail_height')),
array("class" => $theme->get_option('singlepost_thumbnail_position') . " post_thumbnail",
'alt'=>get_the_title(), 'title'=> get_the_title())
);
}
the_content('');
wp_link_pages( array( 'before' => '' . __( 'Pages:', 'flexithemes' ) . '', 'after' => '
' ) );
?>
添加上:
<!--copyright--><div class="acopyright"><p>转载文章请注明,转载自:<strong><?php bloginfo('name'); ?></strong> [ <a href="<?php echo get_settings('home'); ?>"><?php echo get_settings('home'); ?></a> ]</p><p>原文链接:<a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php the_permalink(); ?></a></p></div><!--end copyright-->
保存即可。最后添加一段CSS代码:
/*****************文章版权***********************/
.acopyright {
margin:10px auto;
padding:7px 10px;
width:548px;
height:60px;
font-size:12px;
border:1px dashed #669900;
background-color:#ebe6da;
-khtml-border-radius: 3px;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;}
---------------------------------------------------------
搞定!