How to create project for every WordPress plugin
By Petr on Oct 07, 2008
In the previous entries about WordPress I have describe how to develop a WordPress plugin inside WordPress. This entry describes how to set up a project in NetBeans for every plugin separately.
Let say that I develop many WordPress plugin. The folder structure is displayed on the picture.
I have folder WordPressPlugins that contains all plugins which I develop. Also I have one copy of WordPress sources in WordPressSources folder jut only for development reason. I will explain the reason later.
Then there is wordpress folder under Apache document root, which is accessible through the URL http://localhost/wordpress.
Now create the next plugin. Open new PHP Application wizard and call the project for example AnotherWPPlugin. The source folder for the project will be under the folder, where all WordPress plugins are developed. NetBeans will create in WordPressPlugins folder AnotherWPPlugin folder with the sources and nbproject folder for NetBeans metadata. The second step in the wizard should look like on the picture.
Basically similar approach is if you want to create project for an already existing plugin.
In the next step you specify, how the project will be run. Run Configuration should be Local Web Site. The WodPress is reachable under http://localhost/wordpress URL. Also you have to say to NetBeans that the plugin sources has to be copied to the WordPress. So check the Copy files form Source Folder to another location and browse the plugins folder under the Apache's documented root.
So the third step of the wizard should look like:
After creating the project go to the Project properties and add the WordPressSources folder into Include Path. The reason is that we want to have the WordPress API in code completion. Sure we can put into Include Path the wordpress folder located under the Apache's document root, but then you will see the statements from the developed plugin in code completion twise. The first one from the sources folder and the second one from the plugins folder under document root.
NetBeans will create index.php file. You can use it and change the content to be an entry point for the plugin. More here.