4th Street Bar Hive-Bar

Hive-Bar Powered by Hive beta-fdb5b5b

Community post

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

https://chakela.me/wp-content/uploads/2019/11/auto-add-copyright.jpg

之前的文章我都是手动添加一些关联链接和版权信息,每次都得返回编辑其他文章查看代码,想着一劳永逸的解决这个问题,于是在网上找到了一些方法,针对在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/
47 upvotes $0.29

Replies (2)

Review before signing

Posting as . Signing with . Keychain permission: Posting. Hive Keychain will ask you to approve this action next.


  
Technical details

Operation fingerprint: