While there are many ways to protect your content from theft but adding a link back to your post automatically using RSS feed will make a lot of real sense. With this way, people who use your RSS feed to publish your content on their own websites automatically will automatically end it up in publishing your copyright notice as well as giving you a backlink. In order to achieve this, simply add the following code to your theme’s functions.php file while you are free to customize copyright notice on line 4.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | <?php /* Template Name: Custom Feed */ $numposts = 5; function yoast_rss_date( $timestamp = null ) { $timestamp = ($timestamp==null) ? time() : $timestamp; echo date(DATE_RSS, $timestamp); } function yoast_rss_text_limit($string, $length, $replacer = '...') { $string = strip_tags($string); if(strlen($string) > $length) return (preg_match('/^(.*)\W.*$/', substr($string, 0, $length+1), $matches) ? $matches[1] : substr($string, 0, $length)) . $replacer; return $string; } $posts = query_posts('showposts='.$numposts); $lastpost = $numposts - 1; header("Content-Type: application/rss+xml; charset=UTF-8"); echo '<?xml version="1.0"?>'; ?><rss version="2.0"> <channel> <title>Yoast E-mail Update</title> <link>http://yoast.com/</link> <description>The latest blog posts from Yoast.com.</description> <language>en-us</language> <pubDate><?php yoast_rss_date( strtotime($ps[$lastpost]->post_date_gmt) ); ?></pubDate> <lastBuildDate><?php yoast_rss_date( strtotime($ps[$lastpost]->post_date_gmt) ); ?></lastBuildDate> <managingEditor>joost@yoast.com</managingEditor> <?php foreach ($posts as $post) { ?> <item> <title><?php echo get_the_title($post->ID); ?></title> <link><?php echo get_permalink($post->ID); ?></link> <description><?php echo '<![CDATA['.yoast_rss_text_limit($post->post_content, 500).'<br/><br/>Keep on reading: <a href="'.get_permalink($post->ID).'">'.get_the_title($post->ID).'</a>'.']]>'; ?></description> <pubDate><?php yoast_rss_date( strtotime($post->post_date_gmt) ); ?></pubDate> <guid><?php echo get_permalink($post->ID); ?></guid> </item> <?php } ?> </channel> </rss> |
Snippet Source/Credit: Yoast