Invoking a callback to display metaboxes
-
I am customising a post type:
add_action( 'init', 'register_team_sheet' ); function register_team_sheet(){ $labels = array(...); $args = array(...); register_post_type( 'team_list_event', $args ); }
I have defined my metaboxes
function team_list_add_meta_box(){ add_meta_box('team_list_event','Team Event fields','team_event_show_box', 'post'); } add_action('admin_menu','team_list_add_meta_box');
And defined my callback:
function team_event_show_box(){ echo '<input type="hidden" name="team_list_meta_box_nonce" value="', wp_create_nonce(basename(__FILE__)), '" />'; $box_fields=array(...); foreach($box_fields as $field){ ... render field... }
But my callback never gets called and the metaboxes are never rendered.
This is understandable because I haven’t linked the register_team_sheet() function to the callback.
The register_team_sheet function is visible in the Dashboard and can be invoked, but the metabox fields are not drawn.
How do I go about making sure that the callback is called when the register_team_sheet post type is selected?
Many thanks,
Dave
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Invoking a callback to display metaboxes’ is closed to new replies.