Plugins can be a confusing concept for WordPress newbies. It may seem obvious to many of you, but it bears remembering that plugins are just a container for additional code. There is nothing “special” about them – literally anyone can develop a plugin.
That is both a blessing and a curse. The fact that the barriers of entry to plugin development are so low is great in a sense that there are so many available, but also rather detrimental for the same reason. The simple fact is that a lot of plugins out there are bloated and buggy. And for many, their functionality could be replicated with a simple code snippet.
Wouldn’t you rather have a well-extended functions.php file then a whole load of separate plugins installed and activated on your WordPress blog?
The Benefits of Code Snippets
A code snippet is exactly what you expect it to be – a snippet of code. It could be called a plugin if you packaged it as such, but when a snippet is small and uncomplicated, it makes more sense to simply add it to your theme’s functions.php file.
Using code snippets keeps your plugins list more manageable, and ensures that you are not installing plugins with bloated and unnecessary code.
Not only that, they are extremely simple to implement. You can copy and paste code snippets into your functions.php file with absolute ease. To learn more about functions.php, click here.
WP Function Me
Now that we’ve discussed the benefits of using code snippets, you might be hoping for examples. Well, in the interests of not disappointing, I would like to introduce you to WP Function Me – an extremely slick code snippets repository.
The site is cleanly laid out and easy to use. At the top, you can choose from 5 different categories. Each snippet is advertised with a brief summary. If a particular snippet catches your eye, just check the box in the top left corner:
If you want to take a look at the snippet itself, just click on “Preview” in the bottom right.
Select any number of snippets, and once you’re done, scroll to the bottom of the page and hit “Get Your Code!”
Now all you need to do is copy the resultant code and paste it into your functions.php file. You can do this either by accessing the file via FTP, or by using the WordPress theme editor (found under “Appearance” in the sidebar).
That’s it! The selected functionality will now be enabled on your site. It really is that simple.
At this time, WP Function Me has a selection of 21 code snippets, some of which cover extremely common user requests. Even if you do not think you require any additional functionality at this stage, it may be worth a look.
What’s Your Favorite?
Is there a particular snippet on WP Function Me that you find useful? Or do you perhaps consider there to be additional snippets that should be made available? Let us know in the comments section!
David
Can you write code snippets to change attributes of Setting in WP, like turn on or off “Discourage Search Engines,” for example? Can you write snippets to change attributes of plugins as well?