Category Archives: WordPress Tips

How To Avoid People Steal Your Blog Content?

I found people stealing my content the other day without refering back to my blog, so i was looking for a way to force content origin information added the content when copy and paste.

Add the following snippet to end of your “single.php” file, and it will generate “Original: [your blog name] URL:[your post url]” to the content they copy. It won’t make them stop stealing your content, but it will certainly make it a bit more annoying for them.

This will not be visible on the web page at all.

<script type="text/javascript">
document.body.oncopy=function(){
 event.returnValue=false;
 var t=document.selection.createRange().text;
 var s="Original Post From <?php bloginfo('name'); ?> , URL: <?php the_permalink() ?> ";
 clipboardData.setData('Text','rn'+t+'rn'+s+'rn');
}
</script>

Add Favicon (logo) To WordPress Site

You need to create a image file that has a ‘.ico’ extension, dimension 16px X 16px.
You can use Photoshop for this, but I use Gimp, which is free. (note: windows Paint doesn’t support this format)

then upload it to your theme image folder.

Modify the theme name in the path to the one you are using, and copy it to the header.php file.

[sourcecode language=”html”]

<link rel="shortcut icon" href="<?php echo home_url( ‘/ctt/themes/twentyeleven/images/favicon.ico’ );?>" type="image/vnd.microsoft.icon"/>
<link rel="icon" href="<?php echo home_url( ‘/ctt/themes/twentyeleven/images/favicon.ico’ );?>" type="image/x-ico"/>

[/sourcecode]

Exclude a category from recent post on home page

To hide posts from category/categories, from showing up on your index page, is easy. You don’t need a plugin for this. Simply add one line of code on your index.php, and BAM! Work!

Go to index.php in your theme folder, find the “while” loop, where the posts are loop through and rendered on the page:

[sourcecode language=”php”]
<?php while ( have_posts() ) : the_post();?>

<?php
// ….
// more codes here, skipping…
// ….
?>

<?php endwhile;?>
[/sourcecode]

Read More