My metabox class

I’m using the class My Metabox class

*-- Custom Post Init Begin --*/  

function mypost_types(){
    register_post_type('video', 
    array(
        $labels = array(
            'name' => __( 'video' ),
            singular_name' => __( 'video'),
            'add_new_item' =>__('Add New video'),
            'edit_item' => __('Edit video'),
            'view_item' => __('View video')
        ),

        'labels' => $labels,
        'public' => true,
        'show_ui' => true,
        'capability_type' => 'post',
        'supports' =>  array('title','editor','excerpt','thumbnail','custom-fields')
    );
}   
add_action('init', 'mypost_types');

________second version after @kaiser comment

/*-- Custom Post Init Begin --*/  

`

 function mypost_types(){
{ 
$labels = array(
'name' => __( 'video' ),
'singular_name' => __( 'video' ),
'add_new_item' =>__('Add New video'),
'edit_item' => __('Edit video'),
'view_item' => __('View video')
);
$args = array(
'labels' => $labels,
    'public' => true,
    'show_ui' => true,
    'capability_type' => 'post',
    'supports' =>     array('title','editor','excerpt','thumbnail','custom-fields')
     );

    register_post_type('video', $args);
}   
      add_action('init', 'mypost_types');`

I have a problem to add this class in register_post_type. Does anybody know how to implement it?

Thanks.

1 Answer
1

it says right in the instructions that you just include the class

//include the main class file
require_once("meta-box-class/my-meta-box-class.php");

you’d put that in whatever file you are using for the code blocks you posted… not in the function you’ve written.

looks like there is a pretty good section called “Usage” at the link you provided. you should re-read that and revise your question to explain more clearly what your problem is that is not answered by the provided documentation.

Leave a Comment