I am trying to create two additional add_meta_box context locations ('after_title' and 'after_editor') within posts.
This doesn't appear to do what I think it should. The meta box does appear on the page just within the normal context, not in the new defined context locations. Does anyone have any insight on this?
Thank you in advance for your time and consideration,
Tim
REFERENCES:
ACTION HOOKS:
public function initialize_hooks() {
add_action( 'edit_form_after_editor', array( $this, 'add_after_editor_meta_boxes' ) );
add_action( 'edit_form_after_title', array( $this, 'add_after_title_meta_boxes' ) ) ;
}
/**
* Register meta box context position: after_editor
*
* @return null
**/
public function add_after_editor_meta_boxes() {
global $post, $wp_meta_boxes;
# Output the `after_editor` meta boxes:
do_meta_boxes( get_current_screen(), 'after_editor', $post );
}
/**
* Register meta box context position: after_title
*
* @return null
**/
public function add_after_title_meta_boxes() {
global $post, $wp_meta_boxes;
# Output the `after_title` meta boxes:
do_meta_boxes( get_current_screen(), 'after_title', $post );
}
ADD META BOX:
/**
* The function responsible for creating the actual meta box.
*
* @since 0.2.0
**/
public function add_meta_box() {
add_meta_box(
'authors-commentary',
"Author's Commentary",
array( $this, 'display_meta_box' ),
'after_editor',
'high',
'default'
);
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire