WordPress 技巧:在日志下添加作者头像和版权申明

[php]
<?php
/*
Plugin Name: 版权申明
Plugin URI: http://fairyfish.net/m/copyright/
Description: 在日志下面添加版权申明
Version: 0.1
Author: Denis
*/
function post_copyright(){
if(is_single()){
global $post,$authordata;
?>
<div id="copyright">
<?php echo get_avatar($authordata->ID,'55');?>
<div>
<p>作者:<a href="<?php echo $authordata->user_url; ?>" title="<?php echo $authordata->display_name;?>"><?php echo $authordata->display_name;?></a><br />
原文链接:<a href="<?php echo get_permalink($post->ID);?>" title="<?php echo $post->post_title; ?>"><?php echo $post->post_title; ?></a><br />
版权声明:自由转载-非商用-非衍生-保持署名 | <a href="http://creativecommons.org/licenses/by-nc-nd/3.0/deed.zh&quot&gtCreative; Commons BY-NC-ND 3.0</a></p>
</div>
</div>
<?php
}
}
add_filter('the_content','post_copyright_content');
function post_copyright_content($text){
ob_start();
post_copyright();
$post_copyright_content = ob_get_contents();
ob_end_clean();
return $text.$post_copyright_content;
}
?>
[/php]
自行添加以上代码到主题下面的functions.php页面即可
转自http://fairyfish.net/m/copyright/,转载请注明出处!