Gimhoy's Blog

您曾经浏览过

WordPress自动在内容底部增加版权信息

本文最后更新于2013年5月8日,已超过三年没有更新,如果文章内容失效,请反馈给我们,谢谢!

在主题目录下找到functions.php,在最后一个”?>”之前,插入如下代码,便可以为你的文章和feed同时增加版权信息:

function feed_copyright($content) { 
if(is_single() or is_feed()) { 
$content.= '<br /><br /><div>欢迎转载,转载请注明来源:<a rel="bookmark" title="'.get_the_title().'" href="https://blog.gimhoy.com/'.get_permalink().'">'.get_the_title().'</a></div>'; 
$content.= '<div>本文链接地址:<a rel="bookmark" title="'.get_the_title().'" href="https://blog.gimhoy.com/'.get_permalink().'">'.get_permalink().'</a></div>'; 
$content.= "</blockquote>"; 
} 
return $content; 
} 
add_filter ('the_content', 'feed_copyright');


免费获得每月10G空间+10G免费流量
  • Comment (3)
  • Trackback (0)
  • 福利SIR Google Chrome Windows 2015/08/28 14:05 @Ta

    你这个广告是用什么插件?

    #25
  • 蚂蚁 Google Chrome Windows 2014/10/29 17:55 @Ta

    如果我想排除指定分类的文章应该怎样调整代码?

    #24
  • 办公家具品牌 Google Chrome Windows 2013/11/11 16:55 @Ta

    原来这个转载的代码是这样的,不知道跟其他代码比起来怎么样!

    #23
  • 还没有Trackback
Leave a Reply

*

*