33 thoughts on “WordPress tips and tricks – functions.php Leave a comment

  1. I am looking at using that file to create some custom functions to override/mimic standard wordpress function. Should make additions a lot easier.

  2. functions.php is pretty slick, I’ve added a recent comments as well as a related posts function, but now I’m stuck with a dropdown tree menu function.

  3. Nice hint Ben!
    functions.php is indeed a very easy way to include anything in a wp-theme…

  4. Hello, I have been using your Regulus theme since creating my blog (on wordpress.com) because I really love it for its simplicity and straightforwardness, b/g color selection, tabs and the ability to change the header. However, I seem to be limited by the fact that there is no plugins function or am I missing something? (I would like to be able to insert video or a java poll please.) *Help!*

    Thanks in advance.

  5. Blend, Iwo, Daniel – thanks πŸ™‚

    Luke – it’s a great idea. Without this I wouldn’t have been able to do the admin page in Regulus. It opens up stacks of possibilities.

    KVilla – I don’t have any control over the features allowed on WordPress.com. You would do better to ask them for help. The issue is largely a security one. They can’t allow people to do whatever they want as it would potentially open up security issues. If you really want to customise things they you should pay for some webspace and set up your own, self hosted, blog. Then you will be able to do whatever you like.

  6. Thank you for the quick response, Ben. I am new to wordpress.com. Can you please confirm if the plugins option is only allowed on wordpress.org, therefore all blogs hosted on its free site disallow plugins? Is there another way at showing a video (either as .swf or .wmv) as a post? Currently, I have an animated gift posted in one of the tabs at the site, but I would very much love to be able to show the longer video file instead.

  7. KVilla – you are correct that plugins don’t work on wordpress.com. The best way to run wordpress is self hosted with the download from wordpress.org but obviously you need webspace for that. I would suggest asking for help on the wordpress.com forums as I don’t have much experience with the system over there so can’t really suggest anything.

    Hope you get it all working

  8. Pingback: Weblog Tools Collection » Blog Archive » Managing Trackbacks and Pingbacks in Your WordPress Theme
  9. Im glad if i find a “trick” or tip to put extra fields in comments.php

    How made this, run a query ?
    what happened with the comments.php to make it work ?

  10. hi i am new to this site.i am a 20 yrs and working as a php trainee.i want the tips to improve my knowledge

  11. Hi,
    Your blog design is truly wonderful and very novel. The first thing I noticed about it was the fact that the page scrolls down but the Adsense in the sidebar remains in place. What a great implementation! I would really it if you cold share this trick with me…

  12. Hi Ben,

    Your post makes this all sound so easy, but I’m stuck on step #1. Where do I find the theme folder?

    My site is still hosted at wordpress.com and doesn’t have its own domain name yet. Is that why I don’t see anything called theme folder? I have no idea where to find/create the functions.php thing.

    Your help is appreciated.


    1. Hi JoAnna – Unfortunately if you use WordPress.com then the changes mentioned in this tutorial are simply not possible. You would need to buy your own webspace and download and install WordPress yourself for to be able to make the changes I mentioned.

  13. Pingback: WordPress Tutorial: Permalink Structure › Binary Moon
  14. I’am not trying to be rude, but this is a useless post. At the very least provide some kind of information on “how” to edit the functions file.

    I followed the instructions at the wordpress.org site, added my own functions, and now I’am getting a “header already sent” error message.

    The #2 in the above post – Add functions to it. – does not seem to be that easy.

  15. I was quite worried I’d have to use a hook, or edit a core WP file. I guess I don’t! Thanks for describing this. And never mind @Kevin. πŸ™‚

  16. Hi Ben,

    For the first time I understood the functions.php, thanks to your neat post.

    I stumbled upon it while I was trying to add a short code to my site. Worked like a charm. However, there is minor problem. If you could help. I will try and explain my case as clearly as possible.

    I use a theme called ‘Mystique’. It has an option to add custom functions to functions.php (how sweet). I add a small piece of code, as instructed by the author. The code works (I guess). My problem is, the output/display is shown right at the top of the page. πŸ™ There goes the neat and clean layout. I wish to have it at the bottom of the page. Like a footer. What do I do?
    The code is from freerelative links site. They have sent me 4 php files and instructions to add on the home page.

    Thanks in advance. Keep doing good work, if not money, at least you will accumulate good Karma points by helping total idiots like me. πŸ˜€

  17. Okay for a complete newbie, where is the theme folder? I really want to do this myself and connect the “facebook like” plugin on my site. Can you break it down for a newbie customizing a free wordpress site? I don’t see “plugins” in my dashboard yet either. How do I make that appear? Could some themes not allow plugins?


    1. Hey James,
      When you log into WP, there’s a menu on the left hand side (in the dashboard). It could be collapsed, in which case you have to click a >> icon at the top to expand it. There, you’ll find the “Plugins” option towards the bottom of the menu and you’ll find a variety of facebook like and facebook connect plugins that will probably suit your purposes. πŸ™‚

  18. Hello everyone,

    First of all I have to say I’m a technology dummy and I’m very sorry if anyone finds my questions stupid. I’m currently using my own webspace hosted at Godaddy and powered by WordPress, so according to what you say above I should be able to find the functions.php file.

    My problem is: I’m using a theme called Treba and want to widgetize and enable custom-background. However this theme doesn’t have a functions.php file. You say that I can “create” one but honestly I don’t know how to create it. Please help me step by step so that I don’t feel lost on the way.

    Your help is much appreciated!!!


  19. Pingback: Optimizing WordPress 404′s
  20. Good post! I am learning how to design a good wordpress blog by myself, your post is very useful for me, thank you very much!

  21. I’m new to this too and struggling a bit how to create this file under the ‘Themes’ section. any help would be great.

    Great article by the way.

  22. I’m new to this too and struggling a bit how to create this file under the ‘Themes’ section. any help would be great.

  23. Hi,

    Can i reuse the class’s mathods into the functions.php file ?
    If so, please give me any one example.


  24. Will adding this function.php work to add posts and pages in WordPress with .php code? I wanted to add some pages with .php, but I don’t want to use the WordPress “allow .php posts and pages” plug-in because, I tried it on a site and it cause the site to totally crash. Fortunately, I had just started the site, so rebuilding it was no big deal.

Leave a Reply

Your email address will not be published.