Themergency
WordPress Code Generator

Generate Your WordPress Custom Post Type Code

| 25 Comments

I released a code generator on the site last night that I thought was worth a blog post. I have also added it to a new section on the site aptly named “Generators”. I have a couple of WordPress related code generators in mind and this is the first of them.

You can now easily, and within minutes, generate the code needed to register a custom post type for WordPress. It is done through an easy wizard-driven form that will output your code once you have filled in all the fields. No coding experience required, and I also tried to explain what each field is for, so hopefully anyone at any level will find it useful.

Why Create A Code Generator

I wanted a way to easily create the code for registering a custom post type, without needing to constantly check the WordPress codex or plugin development books, because there are over 20 arguments that can be used. I also wanted a nice alternative to using a CPT plugin. And the last reason was I wanted to challenge myself and see if I could do it. I wanted to push Gravity Forms to it’s limits, and once again I am not disappointed.

How Was It Made

  1. The form itself is made using Gravity Forms, made up of 6 pages and 48 fields. Yes 48! It took a helluva long time to add the fields.

     

  2. I added some extra jQuery magic to pre populate some fields (including using the typewatch plugin)

     

  3. I wrote a WordPress plugin that takes the form entry and fills in a template and outputs the code

     

Give It A Try

Please give it a try and let me know what you think by leaving a comment below. And as always, please feel free to donate if this code generator has helped you in some way. This code generator took a lot of my spare time to develop, so any donations go a long way in keeping me motivated :)

Post comment as twitter logo facebook logo
Sort: Newest | Oldest
Oleg 5 pts

It saves a lot of pain. But what is missing are the custom input fields that WordPress needs so much.

jlapitan 7 pts

the css of the form says display:none

screenshot-- > http://tardis1.tinygrab.com/avlv

themergency 10 pts moderator

jlapitan it seemed to be a js problem caused by another plugin which I have now disabled. The form should show now. Please confirm.

jlapitan 7 pts

themergency yap! its working now.. would like to inform you that i write a quick tutorial for http://wp.tutsplus.com/ that features your code generators.. it will be posted soon..

themergency 10 pts moderator

jlapitan great :) thanks for the help. Looking forward to your tut

jlapitan 7 pts

themergency its not actually a tut, its a quicktip for other wordpress developers, i suggest on my tip to use your generator.. why not develop this one as a plugin and then sell it at codecanyon.net or write a tutorial at wptuts.

jlapitan 7 pts

the form disappeared what happened??? http://tardis1.tinygrab.com/avkT

themergency 10 pts moderator

jlapitan It loads fine for me. What browser are you using? Also, is there some javascript errors on the page?

jlapitan 7 pts

themergency chrome and firefox, not displaying.. maybe some cookies.. will try to restart my pc

jlapitan 7 pts

themergency i still have problems.. cant view the forms.. :(

jlapitan 7 pts

themergency i tried to access this page on my android phone and the form is not present also..

Thanks for this. Makes it easier to create those CPT. Now I need to figure out how to get them to display correctly in a seperate page.

Awesome generator! I'm working on building my first run-through of this for a client site and I added in some taxonomies into it but for some reason it's not showing the boxes for those taxonomies on the "Add New" page in the WordPress admin.

Is there something I'm missing that I need to do?

Nice post and nice tool. As a proof of it, here go all the references compiled by another great service build on WordPress: http://brief.ly/xz9lj/

Using custom post types too.

This is a rather really sweet piece of code! So glad someone thought about it, and boy what a time saver! I know I always fall back on hard coding, but I'd definitely like to try this out a bit in the future.

Awesome and very helpful!

Only thing I would suggest is adding another field to specify an optional text domain to use in the _x() function. Still, very cool.

cool idea. I will add this in a future update. Thanks!

I suggest adding the text you use to describe your generator on the generator page ("Quickly and easily generate your WordPress [...] No coding knowledge required!") onto the page of the generator itself. Also: add a link to the codex-entry for CTPs.

Some form-fields could be rearranged to make more "human" sense (e.g.: singular before plural) and instead of copy&pasted help-texts from the Codex, some other texts should be used instead (I'm still trying to figure out, what the hierarchical-option means).

Last but not least: "Post Type Key" should check for "max. 20 characters, can not contain capital letters". It converts uppercase letters but doesn't throw an error or give a hint about it.

nice work ;) any plans on releasing the code?

lol - i will def release the plugins that generate the code after I have refactored the code. It's still in a "pre-public" state :)

GaryJ 5 pts

Any further progress with this? I'm really interested in seeing the plugin, as I'm looking to use GF to create a report from a submitted form, and I'm not sure how it should work. Any pointers to resources you used?

Trackbacks

  1. [...] Vincent posted about the thought process behind his custom post type generator, built on Gravity [...]

  2. [...] nifty tool was only released earlier this month (May 2011) and you can read about how Brad Vincent developed the generator (using Gravity [...]