This is a guest post by Dana . Register and start guest posting here on Serradinho. You can also increase your monthly income by joining our Revenue Sharing Program. You have nothing to lose and so much to gain!
As you may already aware that WordPress function.php is really important for our WordPress blog. Function.php consist of many PHP functions which makes our WordPress blog run properly and have other features. Therefore, if we mess up with our functions file, surely our WordPress blog will be a disaster.
From my own experience, a tiny error in the functions file could result in your blog being down or not available. This only means that customizations to the functions file is really a high risk task. There are many bloggers who avoid editing the functions file due to this risk.
As a blogger which is really serious about attaining our goals and taking our blog into the next level – we eventually do edit the function.php file with our customizations and the results are noticable.
It is because after doing many WordPress customizations by utilizing the theme features, so we need do some PHP coding, we will find that the theme features are able to fulfill our requirements.
Do function.php customization for author bio creation
And that’s what I found out when trying to make the author bio show in each post right after blog post and before related post list. After doing some research on the internet, I finally found a way to accomplish it via a tutorial. A way that required some customization by adding some PHP code.
At that time, I was not aware how important the functions file really was. I just added the PHP code in the functions file, which was of course the wrong code. It made my blog appear broken, which only showed an error message when I tried to browse it.
George has previously written a guest post about creating the author bio box over at ThesisThemeHQ.com. Go have a look and try it out as there are also other customizations listed.
My Blog Function.php is broken and the learning curve
My blog was broken because of the coding customization that I added, no doubt about that. I could not even access my WordPress dashboard to undo the coding. The only way to solve this was with direct access to the functions file via my favorite ftp client, FileZilla.
After editing the functions file, it worked again and I surely learned a huge lesson. I learned that I really need to be careful when editing the functions file. If some code is wrong, it will make my blog go down – including the admin page (WordPress backend). After that bad experience, I’m rethinking about editing the functions file.
I even thought of leaving the customizations to a professional web designer to do. But then, I’m aware that I will never learn anything if I go that route.
And I will surely need to learn about it if want to get my blog to a higher level and if I also want to became a great webmaster. So, I finally decided to continue doing customizations on my own, but also that I need to be more careful when doing so.
Therefore, I do my research once more through the internet. This time I researched how can I do customizations safer. And I found the way – the way that can minimize the customization risk.
But – it is really high risk. Should we do it? If we should, how can we minimize the risk?
Of course we should do customizations as mentioned before. We can minimize the risk, we can even make the risk become zero.
In this article, I will share how we can freely try to create new functions without messing with current functions file and it will make us have zero risk.
We can create a new customization functions file (as example: customized-function.php) as our place to add and customize new functions. We surely can feel free to try new functions on it without being afraid to mess up our current functions file.
We use a separate php file for it. Our current blog theme use function.php as function source, and we do our customizing in customized-function.php.
But, if it is separate, how can our current theme use the customized-function.php?
We can put a command in functions file to call customized-function.php each time. We put the following code in function.php file:
include_once (TEMPLATEPATH . ‘/customized-function.php’);
The above code will tell our blog theme to also load the customized-function.php each time the function.php is loaded by our blog theme.
Final Words
Now, we can freely create new functions or customize the old function file without being afraid to affect our blog. We can always isolate customized-function.php from the current theme if some errors happen by commenting the code out in the functions file. This tip is simple and easy to implement and could save us a lot of pain in the end.
What do you think? Do you do something similar? Do you add new functions or do you purchase a theme which already has all this done?
Dana is the founder of Blogging Tips Blog , a blog where he share much about blogging tips, and little about internet and IT. Yup, You will find knowledge sharing about blogging, Internet, and IT in his blog. You can subscribe the LetUpdate dot Com Feed or twitter @danalingga to be updated
View all posts by Dana, there might be other posts that interest you.








{ 28 comments }
Hi Dana,
thanks for the great article, I really appreciate the “I’m aware that I will never learn anything if I go that route” part because this is all it takes to find the inspiration needed to dive into the code and learn some things. It’s even better when you share the things you learn.
.-= Sachin @ Web Design Mauritius´s last blog ..Custom Search: make the most out of Google Maps with optimized geolocation results =-.
Thanks Sachin for liking my writing and for the part that you quoted.
.-= Dana´s last blog ..Theme Junkie Great Discount: 50% Off =-.
Really nice tips George. I am one who often sabotaged my own blog while editing functions.php and I had to access via ftp to correct. The worst is when you forgot to backup a copy of the original file and has to look all over the functions again.
Nice tip. Bookmarked.
.-= Kurt Avish´s last blog ..The 3 First Things To Do After Installing Wordpress =-.
@Kurt – thanks, but this is a guest post by Dana. The credit should not go to me.
You always have to make backups before and after, to ensure you have everything.
Ahh, neat trick. I can admit to screwing up mt WP installs several times by editing key files. I usually end up restoring the files via my host’s backup service. This is a lot more convenient though.
.-= Josiah | Free iPad´s last blog ..Yankees Standium Bans the iPad =-.
Yup, with this we isolate the problem source.
So you do everything in the new customized section, and if you screw it up, it doesn’t touch the blog itself…very cool.
.-= Dennis Edell | Direct Sales Marketing´s last blog ..I asked – You Answered – 4 more Social Icons Added =-.
Yes, it is. With this, every the recovery will be faster if there is something wrong.
For me, I’ll backup first before editing my blog script =)
.-= blinkky´s last blog ..Unique Optical Mouse Design =-.
The backup is a must for both traditional way or this way.
Some day ago I too faced the same issue, in my case I started to edit it offline using Notepad and always take a backup before editing. Nice information for me to get protected in future.
.-= Arafat Hossain Piyada´s last blog ..PenyuLocker – A free folder locking software =-.
Glad if it help you.
Great post and well written. I can relate to making mistakes in my wordpress php. I will try to take note. thanks again.
You’re welcome mate.
Dana, Awesome post. You are quite right. Editing the function.php file without backup or guidance can very very risky and may screw up your site. The way you mentioned i.e. by making a customized-function.php and calling it with the function.php is quite good. Thanks a lot for this awesome tip
We should very careful in function.php customizing. And what I write here is one way to isolate the problem if present.
Very cool tutorial. I never realized that you could edit WP that way! It’s really really tempting to just hand this to a professional though. But you’re right, how else are we going to learn unless we try it out ourselves.
@Sliding Shelves – you are so correct. One needs to give it a try and see what the outcome is otherwise one will always be lazy and never learn.
Hey Dana, I keep on playing with my function files but I always try to be safe with files thus take a backup in advance. Thanks for sharing.
It is a must to play safe when do function file customizing.
Lord knows I’ve ruined my blog on more than two occassions all cause I was careless when adding or removing stuff from my functions.php file. As at now I always backup my functions.php file before embarking on any changes whatsoever
The backup is a must, however with this way, you still able to recover fast even though without the backup.
I am trying out the solution on a TEST installation before i do it on my real blog but i am having some major problems.
First i created the customized-function.php file and uploaded inside my thesis_17 folder. Then i edited the custom-function.php file from inside the wordpress admin by adding this line ….
include_once (public_html/etrainingtt/wp-content/themes/thesis_17 . ‘/customized-function.php’);
I would assume this is my TEMPLATE PATH …. public_html/etrainingtt/wp-content/themes/thesis_17 but i always get php errors that makes my wordpress useless and i have to delete the installation and start over again.
This solution will help me a lot but what am i really doing wrong?
@Sherwin – I see you have the full path and then still the single quotes. Please use the following instead and see if it works:
include_once (“customized-function.php”);
N.B. Please double check that the double quotes are correct as the comment might change it a bit.
Thank You for your suggestion … It worked fine now. I just bookmarked your blog as well as Dana’s because i found some excellent articles that will help me along the way …. Thanks to both of you
As George said, you do not need to put the whole path. However, if it is still can not work, there are may some function conflict with the theme. It may happen with complex theme such as thesis.
Really as long as you make up backup and only do a change at a time you will not have problems when making changes to the function file. This way if what you do messes it up you can always go back to what you had that worked.
@Tracy – yes, I always make backups before I start to make changes.
Comments on this entry are closed.