Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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.

share|improve this question
    
More details + code please. –  kaiser Mar 29 '12 at 18:34
    
Could you please edit the Q and format the code properly? Thanks. –  kaiser Mar 29 '12 at 22:21
    
i put the code in the first comment i hope it is fine, thanks –  teo Mar 29 '12 at 23:24
    
I reformated it. The problems start with missing quotes, assigning $label during calling the register_post_type function and such. Please fix this, read about WP_DEBUG, then come back and show your error messages. –  kaiser Mar 29 '12 at 23:40
    
i put the code in the main comment see => second version –  teo Mar 30 '12 at 0:14
show 2 more comments

1 Answer

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.

share|improve this answer
    
thanks but i read it and do as the "usage doc" show but i think the main problem is in my cutom post declaration. –  teo Mar 30 '12 at 13:21
    
doesn't look like there is anything wrong with your custom post type declaration. and it isn't really related to your usage of the metabox anyway. you can copy and paste the sample code provided in the documentation. there's ONE section that you will need to change to get a metabox on your post type. in the $config array, the sample has an array for the 'pages' value. you'll need to change that to array('video') –  helgatheviking Apr 2 '12 at 14:14
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.