Skip to content

Instantly share code, notes, and snippets.

@MjHead
Created February 26, 2020 08:31
Show Gist options
  • Save MjHead/cd7b725f165e5dc2b0ab981a45dfae6a to your computer and use it in GitHub Desktop.
Save MjHead/cd7b725f165e5dc2b0ab981a45dfae6a to your computer and use it in GitHub Desktop.
Register custom meta box for JetEngine from code
<?php
add_action( 'jet-engine/meta-boxes/register-instances', 'my_register_meta_box' );
function my_register_meta_box( $meta_boxes_manager ) {
// Replace my_post_type_slug with your actual post type slug
$post_type = 'my_post_type_slug';
$object_name = $post_type . '_group';
$meta_boxes_manager->register_custom_group(
$object_name,
__( 'My Post Type Settings', 'jet-appointments-booking' )
);
$meta_boxes_manager->register_metabox(
$post_type,
array(
array(
'type' => 'text',
'name' => '_app_price',
'title' => __( 'Price per slot', 'jet-appointments-booking' ),
),
),
__( 'My Post Type Settings', 'jet-appointments-booking' ),
$object_name
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment