在wordpress文章末尾增加内容的简略办法

1、修正文章页面模板single.php
关上模版文件中的single.php,在其中搜寻
在这行上面加上:


<p>原创文章如转载,请注明本文链接: <a href=”<?php the_permalink() ?>” title=”<?php the_title(); ?>”>
<?php the_permalink(); ?></a>
</p>

就OK了,还有一种办法:

2、关上主题文件夹内的:functions.php文件,在末尾退出代码(复制粘贴时请留意中英文标点):


<?php
function feed_copyright($content) {
if(is_single() or is_feed() or is_page()) {
$content.= ‘<p>本文来自:<a title=”博客” href=”https://www.jb51.net” target=”_blank”>小谈博客</a> &raquo; <a rel=”bookmark” title=”‘.get_the_title().’” href=”‘.get_permalink().’” target=”_blank”>《’.get_the_title().’》</a></p>’;
$content.= ‘<p>本文链接地址:<a rel=”bookmark” title=”‘.get_the_title().’” href=”‘.get_permalink().’” target=”_blank”>’.get_permalink().’</a> &raquo;英雄不问去路,转载请注明出处,谢谢。</p>’;
$content.= ‘<p>有话想说:<a title=”给我留言” href=”‘.get_permalink().’#respond” target=”_blank”>那就连忙去给我留言吧.</a></p>’;
$content.= ‘<p>您也能够订阅本站:<a rel=”external nofollow” title=”小谈博客” href=”https://www.jb51.net/” target=”_blank”>https://www.jb51.net</a></p>’;
}
return $content;
}
add_filter (‘the_content’, ‘feed_copyright’);
?>

推荐此法,不止能够在博客日志页退出链接,包括feed里也能够,完成当前的成果如本文上面显示,蓝色文字局部请依据本人的博客修正。

以上就是安达网络工作室关于《在wordpress文章末尾添加内容的简单方法》的一些看法。更多内容请查看本栏目更多内容!

本文相关话题: wordpress WordPress
版权声明:本文为 安达网络工作室 转载文章,如有侵权请联系我们及时删除。
相关文章
wordpress自定义循环列表的php代码

复制代码代码如下: <?php $epaged = (get_query_var('paged')) ? get_query_var('paged') : 1; $temp = $wp...

WordPress上传图片主动重命名的办法

复制代码代码如下:add_filter( 'wp_handle_upload_prefilter', 'custom_upload_name' ); function custom...

调试WordPress中定时义务的相干PHP脚本示例

普通人们应用WordPress的Cron API来完成定时义务,它的原理就是将创立的定时义务存储到数据库里,当有人拜访...

WordPress建站有哪些劣势

  你还没决议应用什么软件来构建你的新公司网站吗? 依然以为WordPress只是搭建博客吗? 在互联网上有大约2...

WordPress小工具制造办法【左近期评论工具制造】

本文实例讲述了WordPress小工具制造办法。分享给大家供大家参考,详细如下: WordPress是一个领有着无可比拟...

WordPress源代码中文乱码的处理办法

查看相干教程,UTF-8和UTF-8 + BOM有所区别,于是把function.php编码改为后者。成绩处理。 UFT-8 与UTF-8 B...

需求提交

客服服务

亿鸽在线客服系统