andyhsia avatar

如何在文章页尾自动添加版权信息

andyhsia

Published: 04 Nov 2019 › Updated: 04 Nov 2019如何在文章页尾自动添加版权信息

如何在文章页尾自动添加版权信息


之前的文章我都是手动添加一些关联链接和版权信息,每次都得返回编辑其他文章查看代码,想着一劳永逸的解决这个问题,于是在网上找到了一些方法,针对在workpress文章底部自动添加版权信息的段落。

值得注意的是,需要编辑主题文件夹下的funtions.php文件,添加以下代码就可以自动添加版权信息:

//WordPress Article copyright statement
add_filter ('the_content', 'fanly_copyright');
function fanly_copyright($content) {
    if(is_single() or is_feed()) {
        $content.= '<p>本文由<a href="'.get_bloginfo('url').'" target="_blank">'.get_bloginfo('name').'</a>原创,转载请注明:<a title="'.get_the_title().'" href="'.get_permalink().'" target="_blank">'.get_permalink().'</a></p><p>文章同步更新在:<a title="Busy-andyhsia" href="https://busy.org/@andyhsia" target="_blank">Busy-andyhsia</a></p>';
        return $content;
    }
}

如果朋友们也采用的话,记得替换掉代码中的链接和相关个人文本。



Posted from my blog with SteemPress : https://chakela.me/how-to-auto-add-copyright-info-of-content/

Leave 如何在文章页尾自动添加版权信息 to:

Written by

欢迎关注绘画小号@real3earch

Read more #cn posts


Best Posts From andyhsia

We have not curated any of andyhsia's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.

More Posts From andyhsia