How To Add a Copyright Notice and Read More Link to Copied Text in Blogger & WordPress

How To Add a Copyright Notice and Read More Link to Copied Text in Blogger & WordPress

How To Add a Copyright Notice and Read More Link to Copied Text in Blogger & WordPress
How to Add a Read More Attribution Link to Every Copied Text in Blogger & Wordpress

Many popular websites add “Read More” link and “Copyright” notice when content is copied from the webpage. This helps when someone share information with their friends, it adds link as a ref to site. Adding link to copied text helps to generate more traffic. Also Copyright informs to people who are trying to steal content from your site, it gives clear message to them.

Copy this script and paste it into the “<head> or </head>” tags. This function works in most of the browsers, except IE.

Use On Blogger Template 

<script type="text/javascript">
function addLink() {
var body_element = document.getElementsByTagName('body')[0];
var selection;
selection = window.getSelection();
var pagelink = "<br /><br /> Read more at: <a href='"+document.location.href+"'>"+document.location.href+"</a><br />Copyright &amp;copy; EasyTins"; // 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>

Other Method


1. Tynt :

Tynt is a hosted solution which requires you to sign up and Tynt will create a code to insert onto your website. It is also available in a WordPress plugin: Tynt WP Plugin. Tynt also offer analytics on users coming to your site via these pasted links.

Although this service does appear to work well and is easy to setup, we do not really recommend this method based on the comments on this page.

2. Javascript :

You can copy and paste the below javascript into the > head < section of your page.
<script type="text/javascript">// <!&#91;CDATA&#91;
function addLink() {
if (
window.getSelection().containsNode(
document.getElementsByClassName('entry-content')&#91;0&#93;, true)) {
var body_element = document.getElementsByTagName('body')&#91;0&#93;;
var selection;
selection = window.getSelection();
var oldselection = selection
var url = document.URL
var pagelink = "
Read more at The Web Taylor: PAGE TITLE HERE <a href='" + url + "'>" + url + "</a>"; // Change this to suit
var copy_text = selection + pagelink;
var new_div = document.createElement('div');
new_div.style.left='-99999px';
new_div.style.position='absolute';
body_element.appendChild(new_div );
new_div.innerHTML = copy_text ;
selection.selectAllChildren(new_div );
window.setTimeout(function() {
body_element.removeChild(new_div );
},0);
}
}
document.oncopy = addLink;
// &#93;&#93;>
</script>
Or if you are using WordPress, copy and paste the below code into your functions.php file.
function add_copyright_text() {
if (is_single()) { ?&gt;
<script type="text/javascript">// <!&#91;CDATA&#91;
function addLink() {
if (
window.getSelection().containsNode(
document.getElementsByClassName('entry-content')&#91;0&#93;, true)) {
var body_element = document.getElementsByTagName('body')&#91;0&#93;;
var selection;
selection = window.getSelection();
var oldselection = selection
var pagelink = "
Read more at The Web Taylor: <?php the_title(); ?> <a href='<?php echo wp_get_shortlink(get_the_ID()); ?>'><?php echo wp_get_shortlink(get_the_ID()); ?></a>"; // Change this to suit
var copy_text = selection + pagelink;
var new_div = document.createElement('div');
new_div.style.left='-99999px';
new_div.style.position='absolute';
body_element.appendChild(new_div );
new_div.innerHTML = copy_text ;
selection.selectAllChildren(new_div );
window.setTimeout(function() {
body_element.removeChild(new_div );
},0);
}
}
document.oncopy = addLink;
// &#93;&#93;></script>
<!--?php <br ?--> }
}
add_action( 'wp_head', 'add_copyright_text');

3. WordPress Plugin

If you are using WordPress, you can use the Read More Copy Link plugin.
Previous Post
Next Post

post written by:

I am a web designer and developer. Sharing knowledge is my passion and web designing is my interest but it is not bigger than my interest in Islam.

0 Comments: