jaredatch/Custom-Metaboxes-and-Fields-for-WordPress — Issue #103: Add Post Type Select
Author: wpsmith
Created: 2012-01-27 17:59:43+00:00
State: open

I'd love to see a post type select option: https://gist.github.com/1690040
`add_action( 'ntg_render_post_type_select' , 'wps_post_type_select' , 10 , 3 );
function wps_post_type_select ( $field, $meta, $id ) {
global $post;
if ( $field['type'] == 'post_type_select' ) {

echo '';
$pts = get_post_types();

if ( $field['options'] ) {
foreach ($field['options'] as $option) {
echo '
', $option['name'], '
';
}
}
foreach ( get_post_types( $field['post_type_args'], 'objects' ) as $pt ) {
echo '
name ) ,'>' . $pt->labels->name . '
';
}
echo '';
echo '

', $field['desc'], '

';
}
}`