WP-Fun.co.uk

Why you should try Netbeans

Have you heard of NetBeans? It has been around for ages as a Java tool but now it has PHP and a whole load of goodies that make it excellent for WordPress development. Let me lay some out for you.

For this example I have created a new project in NetBeans for WordPress (There is a tutorial here if you don’t know how to do that).

The first point of note is that for some time now Jacob Santos has been diligently documenting the WordPress code. This is quite useful when you are surfing around trying to find out what you want, but with NetBeans all of this documentation is read into the code complete function. So now you have WordPress code completion. For example, if you type add_ac and then press ctrl + space you get:

All documented WordPress functions can be found through the auto complete letting you know the parameters, the options, and even the file where it can be found. But that isn’t all. Often you want to look through the function itself to find out more. That’s easy. Right click on the function to get the menu up:

Selecting find declaration will open the file and scroll to the original function declaration. I can’t tell you how many hours I have spent function hunting before now.

You might also note on that image another option marked Find Usages. Want a quick route to find every hook in WordPress? Well, actions are defined by the do_action function, so type in ‘do_action();’, right click and choose find usages. You get a handy list:

Something else I love are the code shortcuts. For example, type in cls and then tab and you have a class declaration waiting for you to type in the name. It has loads more, functions, loops, conditions, intanceof, and you can add your own shortcuts to that list.

If you are developing for WordPress I recommend giving NetBeans a try. You might also want to take a look at this demonstration screencast that covers most of these points in an example showing how to create a flickr slideshow.