Family Encyclopedia >> Electronics

How to Add a 'Read More' Link to Copied Text on Your WordPress Site

Top sites like eHow smartly append a "Read More" link to copied text, turning shares into traffic. When users copy snippets for emails, notes, or chats, your site gains free promotion. As WordPress experts, we've refined this proven technique for modern sites.

Note: Copy text from this post and paste into email or Notepad to test it live.

Copy this code into your theme's functions.php or a custom plugin:

function add_copyright_text() {
  if (is_single()) { ?>
  <script type="text/javascript">
  function addLink() {
    var entry_content = document.getElementsByClassName('entry-content')[0];
    if (!entry_content || !window.getSelection().containsNode(entry_content, true)) {
      return;
    }
    var body_element = document.getElementsByTagName('body')[0];
    var selection = window.getSelection();
    var pagelink = "<br /><br />Read more on <?php echo esc_html(get_bloginfo('name')); ?>: <a href='<?php echo esc_url(get_shortlink()); ?>'><?php echo esc_url(get_shortlink()); ?></a>";
    var copy_text = selection.toString() + pagelink;
    var new_div = document.createElement('div');
    new_div.style.position = 'absolute';
    new_div.style.left = '-99999px';
    body_element.appendChild(new_div);
    new_div.innerHTML = copy_text;
    selection.selectAllChildren(new_div);
    window.setTimeout(function() {
      body_element.removeChild(new_div);
    }, 0);
  }
  document.addEventListener('copy', addLink);
  </script>
  <?php }
}
add_action('wp_head', 'add_copyright_text');

Now, copied content from single posts includes your branded link. Customize the text as needed.

Update: Optimized for single post pages only, using WordPress shortlinks (e.g., yoursite.com/?p=123 or custom like wpbeg.in) for clean, trackable URLs—no more clunky full links.