[wp-hackers] WP 3.0 and beyond: Custom post types + custom fields
news at maddler.net
Fri Jun 18 20:41:05 UTC 2010
On 06/18/2010 10:30 PM, Matt wrote:
> Now that the custom post type functionality has been refined with 3.0, one
> important next step would be to more closely integrate post types with
> custom fields.
> There's no easy way -- using only core -- to assign certain custom fields to
> a new post depending on its post type.
> For example, a new "Soccer Team" post type. You'd likely want to see custom
> fields like "wins", "losses", "home_field", and "roster" (some sort of
> relationship) show up by default when adding a new Soccer Team.
> The closest thing I could find was the "register_meta_box_cb" argument,
> which lets you add new meta boxes -- not alter the "Custom Fields" area.
> Here's a *really* rough idea of how this functionality could work:
> $args = array(
> 'public' => true,
> 'publicly_queryable' => true,
> 'supports' => array('title', 'editor', 'thumbnail', 'custom-fields'),
> 'custom_fields' => array(
> 'wins' => array('label' => __('Wins'), 'widget' => 'number'),
> 'losses' => array('label' => __('Losses'), 'widget' => 'number',
> 'default' => 0),
> 'home_field' => array('label' => __('Home Field'), 'widget' =>
> ... etc ...
> register_post_type('soccer_team', $args);
> Has any serious thought been given towards this aspect of WP? There are
> several plugins out there that attempt to tackle this in various ways. I'm
> curious as to if there's much interest in this making it into core, and if
> so, what steps have been made thus far.
Yes, I'd seriously be happy to see such a function in WP core. As of now
I've been using custom fields but, you know, ain't that straight forward.
Being able to easily define custom posts an attributes would make
everything a LOT easier. IMHO
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
More information about the wp-hackers