Field Group not showing in settings
Support › MB Settings Page › Field Group not showing in settingsResolved
- This topic has 7 replies, 2 voices, and was last updated 3 years, 5 months ago by
Robert Lane.
Viewing 8 posts - 1 through 8 (of 8 total)
-
AuthorPosts
-
November 8, 2021 at 5:59 AM #31795
Robert Lane
Participantadd_filter( 'rwmb_meta_boxes', 'depts_short_code_page' ); function depts_short_code_page( $meta_boxes ) { $prefix = ''; $meta_boxes[] = [ 'title' => __( 'Shortcode Page Name', 'depts_short_code_page' ), 'id' => 'shortcode-page-name', 'settings_pages' => ['shortcode-page'], 'fields' => [ [ 'name' => __( 'Shortcode Page Name', 'depts_short_code_page' ), 'id' => $prefix . 'depts_shortcode_page', 'type' => 'post', 'post_type' => ['page'], 'field_type' => 'select', 'required' => true, 'columns' => 4, ], ], ]; return $meta_boxes; }
November 8, 2021 at 12:47 PM #31797Long Nguyen
ModeratorHi Robert,
Can you please share the code that creates the settings page on your site?
November 8, 2021 at 9:13 PM #31798Robert Lane
Participantadd_filter( 'mb_settings_pages', 'short_code_page_settings' ); function short_code_page_settings( $settings_pages ) { $settings_pages[] = [ 'menu_title' => __( 'Settings', 'short_code_page_settings' ), 'option_name' => 'Shortcode Page', 'position' => 25, 'parent' => 'edit.php?post_type=department', 'style' => 'no-boxes', 'columns' => 1, 'icon_url' => 'dashicons-admin-generic', ]; return $settings_pages; }
November 8, 2021 at 9:38 PM #31799Long Nguyen
ModeratorHi Robert,
You need to add the parameter
id
and use the parameteroption_name
with the name in lowercase and underscore, with no space and special characters.Please read more on the documentation https://docs.metabox.io/extensions/mb-settings-page/#using-code
November 8, 2021 at 10:02 PM #31802Robert Lane
ParticipantWhy is the ID not being added in the Meta Box AIO when generating the script(s)?
November 8, 2021 at 10:49 PM #31803Robert Lane
ParticipantNot working;
//Shortcode Field Group add_filter( 'rwmb_meta_boxes', 'depts_short_code_page' ); function depts_short_code_page( $meta_boxes ) { $prefix = ''; $meta_boxes[] = [ 'title' => __( 'Shortcode Page Name', 'depts_short_code_page' ), 'id' => 'shortcode-page-name', 'settings_pages' => ['shortcode-page'], 'fields' => [ [ 'name' => __( 'Shortcode Page Name', 'depts_short_code_page' ), 'id' => $prefix . 'depts_shortcode_page', 'type' => 'post', 'post_type' => ['page'], 'field_type' => 'select', 'required' => true, 'columns' => 4, ], ], ]; return $meta_boxes; } //Shortcode Page Settings add_filter( 'mb_settings_pages', 'short_code_page_settings' ); function short_code_page_settings( $settings_pages ) { $settings_pages[] = [ 'menu_title' => __( 'Settings', 'short_code_page_settings' ), 'id' => 'shortcode_page', 'option_name' => 'shortcode_page', 'position' => 25, 'parent' => 'edit.php?post_type=department', 'style' => 'no-boxes', 'columns' => 1, 'icon_url' => 'dashicons-admin-generic', ]; return $settings_pages; }
November 9, 2021 at 12:07 AM #31805Robert Lane
ParticipantMetabox code:
https://gist.github.com/robertlaneSUDO/b7cb662a31af0b5fab9251987b8dd644
November 9, 2021 at 2:23 AM #31811Robert Lane
ParticipantI got it working! Thanks!
-
AuthorPosts
Viewing 8 posts - 1 through 8 (of 8 total)
- You must be logged in to reply to this topic.