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 would like to add a custom write panel to a custom post type. I'm looking at the the code here:

http://wefunction.com/2009/10/revisited-creating-custom-write-panels-in-wordpress/

I can get the custom write panel to appear on a standard post edit page but not for my registered custom post type.

add_meta_box( 'int_parent_meta', ucfirst( $key ) . 'Options',
    'display_meta_box', 'name-of-custom-post-type', 'normal', 'high' );

If I replace 'name-of-custom-post-type' with 'post' in the above line, the panel appears on the post edit screen.

Anyone know what I'm missing here? Wordpress version is 3.0.1

share|improve this question
    
Maybe you are not correctly writing the name of your custom post type? What is its actual name? Can you show your register_post_type code? –  sorich87 Oct 11 '10 at 17:09
    
Can you show us the full code your using (perhaps in a pastebin)? My first instinct is that your custom post type isn't being registered with support for custom meta boxes ... –  EAMann Oct 11 '10 at 18:29
    
thanks - I think I had my arguments incorrect for add_meta_box. Its working now. –  codecowboy Oct 12 '10 at 12:27

1 Answer 1

up vote 2 down vote accepted

the fourth argument should be the name of the custom post type, as defined when you created the post type. see http://codex.wordpress.org/Function_Reference/add_meta_box

For a clearer explanation of how to successfully create metaboxes, see this tutorial

the second argument should be the callback function, you can create the drop down HTML in a function, and place the function name in this argument and you'll have your pull down menu.

share|improve this answer
    
thanks! That tutorial looks better than the others I found. –  codecowboy Oct 12 '10 at 12:28

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.