Support Forum
Support › MB Settings Page › Can't see the fields group title in the settings page tabResolved
I have a settings page tab that has 2 fields groups, and I can't see the title of the fields groups that I want to show to have a visual separator between the two groups.
Is it like this the title of the fields group is not visible? Or it's a bug?
Here's the code that I'm using to define one of the groups:
$meta_boxes[] = [ 'title' => 'Tweets fetching API', 'id' => 'settings_admins__breaking_news', 'settings_pages' => ['settings_admins'], 'tab' => 'settings_admins__breaking_news_tab', 'fields' => [ [ 'name' => 'Enable breaking news Twitter API', 'id' => $id = $prefix . 'breaking_news_enable_api', 'type' => 'checkbox', 'label_description' => '<code class="admins-only">' . $id . '', 'desc' => 'Check to enable the tweets fetching API • Run now', ], [ 'name' => 'Breaking news hashtag', 'id' => $id = $prefix . 'breaking_news_hashtag', 'type' => 'text', 'label_description' => '<code class="admins-only">' . $id . '', 'desc' => 'Capture tweets that only have one of these hashtags (<i>comma separated</i>).', 'size' => 32, ], [ 'name' => 'Default expiry time', 'id' => $id = $prefix . 'breaking_news_default_expiry', 'type' => 'number', 'label_description' => '<code class="admins-only">' . $id . '', 'desc' => 'The default expiry time (<i>in minutes</i>) for the auto created breaking news posts.', 'std' => 30, 'step' => 5, 'size' => 1, ], ], ];
And I'm using the following code to create the settings page:
function register_settings__admins( $settings_pages ) { $settings_pages[] = [ 'id' => 'settings_admins', 'option_name' => 'settings_admins', 'menu_title' => 'Admins Settings', 'parent' => 'options-general.php', 'style' => 'no-boxes', 'tabs' => [ 'settings_admins__general_tab' => 'General', 'settings_admins__sticky_posts_tab' => 'Sticky Posts', 'settings_admins__breaking_news_tab' => 'Breaking News', ], 'tab_style' => 'top', 'icon_url' => 'dashicons-admin-generic', ]; return $settings_pages; }
It seems that the 'style' => 'no-boxes'
behind that. Can't we show the titles of the fields groups in this case?
I have resolved this by adding a vale to the 'before'
key of the first field of each group, like this:
$meta_boxes[] = [ 'title' => $title = 'Tweets fetching API', 'id' => 'settings_admins__breaking_news_api', 'settings_pages' => ['settings_admins'], 'tab' => 'settings_admins__breaking_news_tab', 'fields' => [ [ 'name' => 'Enable tweets fetching API', 'id' => $id = $prefix . 'breaking_news_enable_api', 'type' => 'checkbox', 'label_description' => '<code class="admins-only">' . $id . '', 'desc' => 'Check to enable the tweets fetching API • Run now', 'before' => '<h3>' . $title . '</h3><hr>', ], [ ... ], [ ... ], ], ];
And here's the result: