Warning: Trying to access array offset on value of type bool in /www/wwwroot/shaodaishan/wp-content/themes/argon/functions.php on line 319
wordpress向复制的文章中自动添加版权信息 – 少岱山

Warning: Trying to access array offset on value of type bool in /www/wwwroot/shaodaishan/wp-content/themes/argon/functions.php on line 319
wordpress向复制的文章中自动添加版权信息

用wordpress建立个人博客的越来越多,当看到自己创作的原创文章被人转载,但是一点都不提及文章真实来源的时候,心里肯定会特别不舒服。虽然我的文章距离被人转载还有很长的路要走,但是也开始考虑版权保护这个问题了。在网上搜了一下,主要的解决方法有两种,一种是禁用鼠标右键,还有一种是在复制日志的时候,自动向粘贴板添加版权信息。

禁用鼠标右键的方法,个人不是很赞成,主要是这种方法在保护版权的同时,也禁止了信息的传播,我们创作文章的目的还是希望能有更多的人看到;所以我比较倾向于向复制的日志中自动添加版权信息的做法。在国内的网站上找了几段js代码,添加到我的网站后进行测试,却发现根本就不起作用,不知道是哪里出了问题。后来几经周折,在国外一个网站上找到了恰当的代码,经过我的测试是有效地,现在分享给大家。

先贴出这段代码的作者的网站,对他的劳动表示感谢:http://bavotasan.com/

<script type="text/javascript">// <![CDATA[
function addLink() {
var body_element = document.getElementsByTagName('body')[0];
var selection;
selection = window.getSelection();
var pagelink = "

: <a href='"+document.location.href+"'>"+document.location.href+"</a>
"; // change this if you want
var copytext = selection + pagelink;
var newdiv = document.createElement('div');
newdiv.style.position='absolute';
newdiv.style.left='-99999px';
body_element.appendChild(newdiv);
newdiv.innerHTML = copytext;
selection.selectAllChildren(newdiv);
window.setTimeout(function() {
body_element.removeChild(newdiv);
},0);
}
document.oncopy = addLink;
// ]]></script>

将上述代码复制后,添加到你的wordpress主题文件的</head>标签之前,保存即可。注意将“啄木游弋 原创精品”修改成你想要显示的内容哦

评论

  1. 12 年前
    2012-10-07 13:30:32

    我去试试这个代码看有没有效果。

  2. sharpain
    12 年前
    2012-10-06 14:34:57

    这段代码我用了,没有效果呢

    • 啄木游弋
      博主
      sharpain
      12 年前
      2012-10-06 19:16:20

      那我就不知道了,抱歉。

  3. 12 年前
    2012-7-17 13:43:57

    I’m honored to get a call coming from a friend as soon as he observed the important recommendations shared on your own site. Studying your blog write-up is a real great experience. Thank you for taking into account readers like me, and I desire for you the best of success like a professional in this field.

  4. 12 年前
    2012-4-29 18:35:42

    难怪 有时候采集 右键不起作用 呵呵

  5. BE
    12 年前
    2012-4-19 21:53:54

    请问这个代码是要加到那个文件里啊?single?

    • 啄木游弋
      博主
      BE
      12 年前
      2012-4-19 21:56:24

      打开header.php文件,把代码复制到该文件的标记之前即可

      • BE
        啄木游弋
        12 年前
        2012-4-19 22:09:11

        好的,谢谢了

        • 啄木游弋
          博主
          BE
          12 年前
          2012-4-19 22:33:35

          太客气啦,欢迎常常交流啊

  6. 12 年前
    2012-4-16 9:24:08

    我复制几个字试试,没有版权信息,倒是感兴趣分享到微博功能,是插件吗

    • 啄木游弋
      博主
      贝游记
      12 年前
      2012-4-16 9:26:26

      我以前那款蓝色主题集成了这项功能,这款橘黄色的板子把版权功能给去掉了,我觉得没几个人屑于复制我的文章,哈哈。微博功能不是插件,感兴趣的话,中午写个简单的添加方法。

  7. 12 年前
    2012-1-09 13:17:49

    很多人转载从来都没留出处的

    • 啄木游弋
      博主
      24小时在分享
      12 年前
      2012-1-09 22:44:34

      这个代码只是帮助由于粗心大意忘记留下转载来源的站长。对于故意剽窃他人劳动成果的采集站长,用什么方法保护版权也没有用处。

  8. 12 年前
    2012-1-08 8:45:32

    我怎么看你底部好多日本网站?

    • 啄木游弋
      博主
      TC
      12 年前
      2012-1-08 9:42:54

      用的sitemix的freehost,就保留了一点他们的广告

  9. 12 年前
    2012-1-07 23:06:45

    学习了!!呵呵!

发送评论 编辑评论


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
上一篇
下一篇