Posted by & filed under Blogging.

If you’ve written more than a couple of WordPress plugins odds are good you’ve copied and pasted the plugin sample readme.txt file into your project. Just sat down to start on my 7th plugin and figured there had to be a better way than Googling for the template, opening it, copying, and pasting.

NetBeans makes it pretty easy though by creating a template.

First thing you’ll need is the WordPress plugin readme.txt sample file. Save it somewhere on your computer because you’ll need it later.

File -> Templates Menu

Now, in NetBeans click on the Tools menu and pick Templates.

You can put the template in any folders that will work with a PHP project. What I did though is create a new folder called WordPress and I’ll put the templates there.

Once you’ve picked the folder, click the Add… button. This will bring up a dialog box for you to browse to where you saved the readme.txt file. Select that file and press Ok.

Before you click close on the Template Manager window, select the template you just created and click Rename. That will allow you to call the template something other than readme.txt. Whatever you put in the Template Display Name field is what will show up when you create a new file. Press Ok and then Close.

Template Manager Window

Now when you add a new file to your project the template will be available. You may have to select Other… from the New File menu the first couple of times before NetBeans picks up and puts the template in your main list.

Add new file dialog box

Now that that’s done, I’m going to go back and add a template for a PHP file with the header already included and a CSS file template with the WordPress theme header already there.

2 Responses to “Adding WordPress templates to NetBeans”

  1. Stergatu Lena

    Cool Post!!!
    Thank you so much for sharing, this tip. Do you have a fileset of templates for wordpress plugins.
    It would be great if you share them :-)))

    • Ryan

      I’ve got two – the readme template and an empty PHP file with the plugin header already in place. Whenever I start working on a theme I’ll probably put a template in for the style.css file. I use the sample stuff from the WordPress codex as my templates.


Leave a Reply

Your email address will not be published. Required fields are marked *