I am trying to create a post type which only displays the Media Library Inline.
I have got the example from this : https://gist.github.com/897503
However, nothing happens when I click "Insert Gallery". The code is as below.
Thanks in advanced!
add_action( 'init', 'create_post_type_gallery' );
function create_post_type_gallery() {
$args = array(
'labels' => post_type_labels( 'Gallery', 'Galleries' ),
'public' => true,
'publicly_queryable' => true,
'register_meta_box_cb' => 'my_gallery_meta_box',
'show_ui' => true,
'show_in_menu' => true,
'query_var' => true,
'rewrite' => true,
'capability_type' => 'post',
'has_archive' => false,
'hierarchical' => false,
'menu_position' => null,
'supports' => array('title','editor' )
);
register_post_type( 'gallery', $args );
}
function my_gallery_meta_box () {
add_meta_box('gallery_details' , 'Media Library', 'my_gallery_meta_box_details', 'gallery', 'normal', 'high' );
}
function my_gallery_meta_box_details () {
global $post;
$post_ID = $post->ID; // global used by get_upload_iframe_src
printf( "<iframe frameborder='0' src=' %s ' style='width: 100%%; height: 500px;'> </iframe>", get_upload_iframe_src('media') );
}
width: 100%%and the functionpost_type_labels()doesn't exist in core - you should get an error there. – kaiser Jan 15 '12 at 19:55%-character. – kaiser Jan 16 '12 at 15:06