WordPress.org

Support

Support » Themes and Templates » Custom Meta boxes for Custom Post Type in 3.0?

Custom Meta boxes for Custom Post Type in 3.0?

  • Hello All,

    I hope their are others out there as pumped about the power of Custom Post Types and Custom Meta Boxes in WordPress 3.0 as I am. As I’m new to the area I imagine others have figured out more than I.

    In my functions.php file I successfully created a new custom post type called “feature”.

    /*Add Feature Custom Post Type*/
    register_post_type(‘feature’, array(
    ‘label’ => __(‘Featured’),
    ‘singular_label’ => __(‘Feature’),
    ‘public’ => true,
    ‘show_ui’ => true, // UI in admin panel
    ‘_builtin’ => false, // It’s a custom post type, not built in!
    ‘_edit_link’ => ‘post.php?post=%d’,
    ‘capability_type’ => ‘post’,
    ‘hierarchical’ => false,
    ‘rewrite’ => array(“slug” => “featured”), // Permalinks format
    ‘supports’ => array(‘title’,’page-attributes’,’custom-fields’,’editor’,’thumbnail’,’excerpt’)
    ));

    In the admin panel for that new custom post type I need to add a few new meta boxes that will only show up their.

    These will be:

    • Subtitle: a single text field with title and description.
    • URL: a single text field with title and description.
    • Quote: a text box with title and description. (the size of Excerpt)
    • Feature: a single checkbox with title and description.
    • Bullets: a text box with title and description. and each line is is put into a list element

    Then I would need the variables for each of those boxes or a way to show each in a template for featured posts.

    This post does pretty much exactly what I need but is not written for WordPress 3.0 and Custom Post Types also its a plugin and I would like to build it into my functions file.
    http://www.wordpressurls.com/example-how-to-add-meta-boxes-to-edit-area/

    Any advice on how to do this, whether articles to look at, or code examples on how to modify the code in the link above, I would be so grateful! I know the plugin, “More Fields” will eventually be available for WP 3.0 but it currently is not, and trying to do this sooner than later. The makers of More Fiends did release More Types which is for 3.0 but that simply creates the Custom Post Type, which I did with code in a few minutes.

    Thank you in advance!

    Cheers,
    Christopher

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Custom Meta boxes for Custom Post Type in 3.0?’ is closed to new replies.