在wordpress每篇文章末尾添加链接
在wordpress每篇文章末尾添加链接,比如你想加个“原创文章如转载,请注明本文链接:”,其实很简单,方法也不只一种:
1、修改文章页面模板single.php,打开模版文件中的single.php,在其中搜索
<?php the_content(); ?>
在这行下面加上
<p> 原创文章如转载,请注明本文链接: <a href=”<?php the_permalink() ?>” title=”<?php the_title(); ?>”><?php the_permalink(); ?></a></p>
就OK了,还有一种方法:
2、推荐此法,不止可以在博客日志页加入链接,包括feed里也可以,实现以后的效果如本文下面显示,蓝色文字部分请根据自己的博客修改。
打开主题文件夹内的:functions.php文件,在末尾加入代码(复制粘贴时请注意中英文标点):
<?php
function feed_copyright($content) {
if(is_single() or is_feed() or is_page()) {
$content.= ‘<div> » 本文来自:<a title=”乌帮图的博客” href=”http://wubangtu.com” target=”_blank”>乌帮图的博客</a> » <a rel=”bookmark” title=”‘.get_the_title().’” href=”‘.get_permalink().’” target=”_blank”>《’.get_the_title().’》</a></div>’;
$content.= ‘<div> » 本文链接地址:<a rel=”bookmark” title=”‘.get_the_title().’” href=”‘.get_permalink().’” target=”_blank”>’.get_permalink().’</a> »英雄不问来路,转载请注明出处,谢谢。</div>’;
$content.= ‘<div> » 有话想说:<a title=”给我留言” href=”‘.get_permalink().’#respond” target=”_blank”>那就赶紧去给我留言吧.</a></div>’;
$content.= ‘<div> » 您也可以订阅本站:<a rel=”external nofollow” title=”订阅乌帮图的博客” href=”http://feed.wubangtu.com/” target=”_blank”>http://feed.wubangtu.com</a></div>’;
}
return $content;
}
add_filter (‘the_content’, ‘feed_copyright’);
?>

Parse error: syntax error, unexpected ‘>’ in C:\wamp\www\wp-content\themes\huanjue2.1\functions.php on line 71 检查中…
用了谢谢。