I am a WP beginner and see the potential of the "Meta Box" plugin (http://wordpress.org/plugins/meta-box/). I have already activated the plugin. So far I managed to upload the demo.php and to display the various meta boxes in the blog post window.
I have already read the documentation, but still I don't know how to register the meta boxes for my custom post type. How do I implement them?
The code of my custom post type (it's about listing artists) looks like this so far:
add_action('init', 'add_cpt_artists');
function add_cpt_artists() {
$labels = array(
'name' => _x('Artists', 'post type general name'),
'singular_name' => _x('Artist', 'post type singular name'),
'add_new' => _x('Add', 'artist'),
'add_new_item' => __('Add new artist'),
'edit_item' => __('Edit artist'),
'new_item' => __('New artist'),
'view_item' => __('View artist'),
'search_items' => __('Search for artist'),
'not_found' => __('No artist found'),
'not_found_in_trash' =>
__('No artist in trash'),
'parent_item_colon' => ''
);
$supports = array('title', 'editor', 'thumbnail', 'excerpt');
$args = array(
'labels' => $labels,
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'_builtin' => false,
'show_in_menu' => true,
'query_var' => true,
'rewrite' => array("slug" => "artists"),
'capability_type' => 'post',
'hierarchical' => false,
'has_archive' => true,
'hierarchical' => false,
'menu_position' => 10,
'supports' => $supports
);
register_post_type('artists',$args);
}
Let's say from the Meta Box plugin I want to add two text areas and a box with checkboxes.
- Where would I insert the code?
- What would the code look like?
- How can I retrieve the content in my page template?