Back to home page
Il Jester
My little dream is in developing

WordPress. Creare un’area per i metabox tra il campo testo e il titolo

E’ possibile creare un’area in cui inserire un metabox tra il campo del titolo e l’area del testo? Certamente sì. E’ possibile. E’ sufficiente usare uno dei tanti filtri che mette a disposizione WordPress.

In questo modo sarà possibile muovere i meta-box anche sopra l’area di testo. Utile soprattutto se si crea un meta-box del sottotitolo, oppure si usa un plugin che ha questa finalità.

Nel file functions.php, dovete semplicemente incollare questo:

add_action( 'add_meta_boxes', 'jb_make_wp_editor_movable', 0 );
function jb_make_wp_editor_movable() {
	global $_wp_post_type_features;
	if (isset($_wp_post_type_features['post']['editor']) && $_wp_post_type_features['post']['editor']) {
		unset($_wp_post_type_features['post']['editor']);
		add_meta_box(
			'description_sectionid',
			__('Description'),
			'jb_inner_custom_box',
			'post', 'normal', 'high'
		);
	}
}
function jb_inner_custom_box( $post ) {
	the_editor($post->post_content);
}
E' un post utile?00