Custom Post Type Code Generator by Themergency
I found this generator quite by accident whilst looking up articles about Custom Post Types and thought I should let you know about it too:
This is because I think it is the ideal tool for those who are put off using the functions.php method when creating a custom Post Type, as all it requires is some form-filling. So it took all of (the famous WordPress) 5 minutes to go from this empty form:
to this lot of code (full sample code after the cut):
This nifty tool was only released earlier this month (May 2011) and you can read about how Brad Vincent developed the generator (using Gravity Forms) and from his comment on 16th May, the plan is to release the plugins that generate the code once he has ‘refactored’ them.
So if you’re using a plugin like Custom Post Type UI (one of my favourites) to create your custom post type and want to try the functions.php method instead, why not start off with the Custom Post Type Code Generator?
The resulting code generated from the form-filling exercise:
add_action( 'init', 'register_cpt_wine' ); function register_cpt_wine() { $labels = array( 'name' => _x( 'Wines', 'wine' ), 'singular_name' => _x( 'Wine', 'wine' ), 'add_new' => _x( 'Add New', 'wine' ), 'add_new_item' => _x( 'Add New Wine', 'wine' ), 'edit_item' => _x( 'Edit Wine', 'wine' ), 'new_item' => _x( 'New Wine', 'wine' ), 'view_item' => _x( 'View Wine', 'wine' ), 'search_items' => _x( 'Search Wines', 'wine' ), 'not_found' => _x( 'No wines found', 'wine' ), 'not_found_in_trash' => _x( 'No wines found in Trash', 'wine' ), 'parent_item_colon' => _x( 'Parent Wine:', 'wine' ), 'menu_name' => _x( 'Wines', 'wine' ), ); $args = array( 'labels' => $labels, 'hierarchical' => false, 'description' => 'Wine Portfolio', 'supports' => array( 'title', 'editor', 'thumbnail' ), 'taxonomies' => array( 'country', 'region', 'supplier_company', 'company', 'brand', 'product_type', 'grape_type' ), 'public' => true, 'show_ui' => true, 'show_in_menu' => true, 'menu_position' => 5, 'show_in_nav_menus' => true, 'publicly_queryable' => true, 'exclude_from_search' => false, 'has_archive' => true, 'query_var' => true, 'can_export' => true, 'rewrite' => true, 'capability_type' => 'post' ); register_post_type( 'wine', $args ); }
There a better tools now like Hasty: https://www.wp-hasty.com
@Simon: Thanks for providing a link to an alternative website. The more choices the better!