WordPress Functions.php Magic

This should interest you WordPress theme tinkerers. Did you know that you can do a lot of cool and neat stuff using that crazy little file functions.php in your theme?

Most off the rack themes particularly the non magazine or CMS style themes have a very bare bones functions.php. Chances are, it holds the basic coding required to widgetize the theme. But oh that’s just the tip of the iceberg. Here’s a run down of a few cool things you can do.

Turn off version reporting – I don’t like how WP inserts the version number into my page. When viewing source code, I like to keep things as light, clean and uncluttered as possible – doesn’t always happen that way because some plugins put in so much junk in the header, but that’s another post. This little code will turn off version reporting. Please note. This is only useful if you have WP versions 2.5 and up I think. Before that the version numbers were always in the theme. Also, if put this in functions.php and is still doesn’t work, check your theme header.php high possibility the version number is in there too.

Credit: ilker

Credit: ilker

Automatically link URLS in posts – Over at BlogEnergizer Premium, to make work faster, we tend to post naked links for members. But alas in WordPress we have to make a link a link before it is clickable. Why can’t it do like most forums do? This little piece of code in functions.php will do just that.

Removing curly braces in your posts. If you post code a lot, like me WordPress can be frustrating as it modifies your posts and kinda breaks your code. This little code in your functions.php takes care of that. Hattip to CatsWhoCode. They also have another example of using functions.php there.

Disabling HTML in comments – I don’t see the value in this. Sure people will put links and stuff like that in but if you insist here you go.

Creating my own functions – Ok this one a little more technical and it was inspired by Chris Pearson on this post. These days, I tend to create my own functions that would make the site much easier to handle when I change themes. Read – don’t have so much work to do over again.

This last one is perhaps most important and flexible of all. There’s lots and lots more you can do in functions.php but it is best done if you know how to write code in PHP even simple PHP will help a ton. I’ll probably post a follow up with more heavy coding soon so stay tuned.

Do You Want A Hands-Free Business?

Then get this guide to help you systemize your business so you'll have more time working on your business.

!
!

Hey! I want to make sure you know what you're getting here. In addition to the guide, you will also receive our memo that includes special offers, announcements and of course actionable information.

Terms and Conditions checkbox is required.
Something went wrong. Please check your entries and try again.
Facebook Comments