1、修正文章页面模板single.php
关上模版文件中的single.php,在其中搜寻
在这行上面加上:
<p>原创文章如转载,请注明本文链接: <a href=”<?php the_permalink() ?>” title=”<?php the_title(); ?>”>
<?php the_permalink(); ?></a>
</p>
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> » <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> »英雄不问去路,转载请注明出处,谢谢。</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’);
?>
以上就是安达网络工作室关于《在wordpress文章末尾添加内容的简单方法》的一些看法。更多内容请查看本栏目更多内容!
WordPress自带的条件标签能够让你根据条件显示不同的内容,比方,你能够反省用户是在首页?能否登陆? PHP if(语...
这些规范化代码蕴含了一些根本的构造框架,你只要按本人的需求填补这个框架,可能的话需求调整某些配置。 不...
get_search_form 函数在 WordPress 中是用来提取预设的搜寻表单或许默许的搜寻表单的。由于民间这个函数没有...
esc_url()(过滤链接) 很多 URL 会有一些小谬误,用 esc_url() 函数能够屏蔽或许修改这些谬误,并且能够回...
明天收到了很多Bloger冤家的E-mail拜年短信,嘿嘿,觉得很好玩,可是他们是如何完成的这个呢,很简略的,可...
置信很多站长都晓得并且曾经在应用WordPress自定义字段,很多插件也应用了这一性能。 自定义字段是一个十分...