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

in #cn5 years ago (edited)


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

帅哥/美女!@wherein邀请您来参加美味就是家常味带我看看,你的城市活动,展现您的精彩生活瞬间。倘若你想让我隐形,请回复“取消”。

Congratulations @andyhsia! You have completed the following achievement on the Steem blockchain and have been rewarded with new badge(s) :

You distributed more than 200 upvotes. Your next target is to reach 300 upvotes.

You can view your badges on your Steem Board and compare to others on the Steem Ranking
If you no longer want to receive notifications, reply to this comment with the word STOP

To support your work, I also upvoted your post!

Do not miss the last post from @steemitboard:

SteemFest⁴ - Meet the Steemians Contest
Vote for @Steemitboard as a witness to get one more award and increased upvotes!

Coin Marketplace

STEEM 0.20
TRX 0.14
JST 0.029
BTC 67443.68
ETH 3234.73
USDT 1.00
SBD 2.65