How to use the snippets
Code snippets is a great way to save some time while developing WordPress templates, and to start using the them is as easy as to copy them, and pasting them at the right place. There are basically two kinds of snippets, those who goes in the template files and those who goes in your templates functions file.
Why shouldn’t I just use plugin instead?
You could. However, if you would use a plugin for every small change you wanted to do to the standard WordPress functionality, you would end up with a lot of plugins! Using the code snippets you find on this website together with the WordPress functions file, you’ll find yourself replacing some plugins with just a line of code.
So when should I use a plugin?
I suggest you use plugins for bigger tasks like advanced galleries, contact forms or adding a dynamic site map. There is no need to reinvent the wheel, so plugins are great when you want to add functionality to your blog, without having to put in a lot of time and work.
Be aware tho, anyone can create a plugin so make sure that it’s well coded and supports your WordPress version.
The functions file
More often than not, the code snippet belongs to the functions file. The functions file is a file located in you template folder, called functions.php. It’s a file that is automatically included, and WordPress will let you put code there that will run at every page lode.
This file basically acts like a plugin, and if it is present in the theme you are using, it is automatically loaded during WordPress initialization (both for admin pages and external pages). – wordpress.org
If you don’t have a functions.php file in your theme folder, you can just create one and put the code in it. A good example of a functions file, you can take a look at the default used in the theme Twenty Eleven which is included in the standard installation of WordPress.
A few examples of snippets that goes in the functions file would be: Add additional image sizes, Remove update notification and Shortcodes in widgets.
The template files
The snippets that doesn’t go in the functions file probably belongs in the template files. A template file could be header.php, page.php, single.php or basically any file except for the functions.php file.
These code snippets often tend to add stuff to your WordPress blog rather than changing or removing stuff, like the snippets that goes in the functions file does. A few good examples could be: Display twitter followers, Breadcrumbs without plugin and Check if last post.