It is hard to recognize the theme that I originally downloaded for free on my website. I have added enough custom tweaks with WordPress Snippets that the original developer probably would be very upset. I have learned a lot from doing this though and it has helped me with my business. By learning how to implement WordPress snippets you can add almost any feature you would like.
The WordPress Codex
The WordPress Codex is the name of the online document that lists all the PHP code functions that come included in a default install. Every theme has these abilities. Your developer decided how to implement them and in what way. Consider it the handbook that will help you get out of any tricky situation.
This is what makes WordPress such an ingenious platform for bloggers. It is open source, so anyone with some time on their hands can learn how to develop a theme. Your primary tool will be PHP. Snippets are going to become your best friend.
Important WordPress Templates
Arguably, there are several documents that you will modify the most when you make changes to your blog.
index.php ¨C This document controls the “blog” layout page. The one where people can see a listing of your most recent posts.
single.php- This template controls the actual layout of an individual post.
page.php- This is one is responsible for the way pages look.
functions.php- This is the big one, has many uses and we will be using it a lot in the following examples.
Before you make any changes, back up your theme! I simply copy and past the php files into a new text document. Save it with a php extension and you will have a back up copy. If something goes wrong, upload the originals into your directory (usually accessible from cpanel or a ftp client).
Finding WordPress Snippets
This is not that hard, typing a simple search will find you many of the most popular ones. These are my favorite resources.
There is strong support in the development community, and they like to share. This great for people who want to learn. Lets look and analyze one snippet.
This code will add a custom message to the end of your RSS feed. You simply add it to your functions.php file.
if ( !function_exists(‘custom_feed_footer’) )
$content .= ‘Your text’;
Lets break it down
<?php- This tells the browser that this is the start of the code.
If Function Exists- This creates a new php function.The name is “custom_feed_footer”. Technically you can call it anything you would like.
The middle of the body determines what our function actually does. Here it says, if you are a feed then add “your text” to it.
The Filters “hook” the functions to one of the WordPress properties.
Lastly ?> declares the code is done.
Once you start experimenting with snippets you will love the freedom it brings. It does take some bravery, you can use Instant WordPress to learn. It creates a local install and you can practice hacking your theme. Once you are comfortable with your changes, and you know it works, you can add the code to your website.
Image Credit : blurbherd