Created
August 21, 2013 14:16
-
-
Save anonymous/6295026 to your computer and use it in GitHub Desktop.
my registered WP custom post, it does not work any longer since wp updated to 3.6
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
/*------ #Add custom portfolio post type------*/ | |
add_action( 'init', 'create_my_post_types' ); | |
function create_my_post_types() { | |
register_post_type( 'Portfolio', | |
array( | |
'labels' => array( | |
'name' => __( 'Portfolio' ), | |
'singular_name' => __( 'Portfolio' ), | |
'add_new' => __('Add a new work'), | |
), | |
'public' => true, | |
'exclude_from_search' => true, | |
'taxonomies' => array('post_tag', 'category'), | |
'menu_position' => 4, | |
'query_var' => true, | |
'supports' => array( 'title', 'editor', 'excerpt', 'custom-fields', 'thumbnail' ), | |
'menu_icon' => get_bloginfo('template_directory') . '/images/portfolio_icon_default_16x16.png', | |
) | |
); | |
} |
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
/*------ #Add Super Custom Post Meta------*/ | |
function my_portfolio() { | |
if ( ! class_exists( 'Super_Custom_Post_Type' ) ) | |
return; | |
// All your SuperCPT magic goes here! | |
$post_meta = new Super_Custom_Post_Meta('Portfolio'); | |
$post_meta->add_meta_box(array( | |
'id' => 'project_detail', | |
'title' => 'Project Detail', | |
'fields' => array( | |
'brief' => array( 'label' => 'Project Brief', 'type' => 'textarea'), | |
'client' => array( 'label' => 'Client', 'type' => 'text' ), | |
'project' => array( 'label' => 'Project', 'type' => 'text' ), | |
'date' => array( 'label' => 'Date', 'type' => 'text' ), | |
'role' => array( 'label' => 'Role', 'type' => 'text' ), | |
'credit' => array( 'label' => 'Credit', 'type' => 'text' ), | |
'site_link' => array( 'label' => 'Site Link', 'type' => 'url'), | |
'display_image' => array( 'label' => 'URL of project display image', 'type' => 'text'), | |
'display_video' => array( 'label' => '(Animation) Display Video HTML Editor', 'type' => 'wysiwyg'), | |
'showcase_image' => array( 'label' => '(Optional) URL of Showcase Image', 'type' => 'text' ), | |
'showcase_copy' => array( 'label' => '(Optional) Showcase Copy', 'type' => 'textarea' ) | |
) | |
)); | |
} | |
add_action( 'after_setup_theme', 'my_portfolio' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment