Forked from alexdunae/wordpress_custom_post_gallery.php
Last active
August 29, 2015 14:11
-
-
Save Irfan-Ansari/31e17ed497d6b312eb15 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
define('MY_POST_TYPE', 'my'); | |
define('MY_POST_SLUG', 'gallery'); | |
function my_register_post_type () { | |
$args = array ( | |
'label' => 'Gallery', | |
'supports' => array( 'title', 'excerpt' ), | |
'register_meta_box_cb' => 'my_meta_box_cb', | |
'show_ui' => true, | |
'query_var' => true | |
); | |
register_post_type( MY_POST_TYPE , $args ); | |
} | |
add_action( 'init', 'my_register_post_type' ); | |
function my_meta_box_cb () { | |
add_meta_box( MY_POST_TYPE . '_details' , 'Media Library', 'my_meta_box_details', MY_POST_TYPE, 'normal', 'high' ); | |
} | |
function my_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: 400px;'> </iframe>", get_upload_iframe_src('media') ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment