Can't see the fields group title in the settings page tab
Support › MB Settings Page › Can't see the fields group title in the settings page tabResolved
- This topic has 2 replies, 1 voice, and was last updated 2 years, 11 months ago by
Alaan TV.
Viewing 3 posts - 1 through 3 (of 3 total)
-
AuthorPosts
-
May 13, 2022 at 5:30 AM #36002
Alaan TV
ParticipantI 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, ], ], ];
May 13, 2022 at 7:06 AM #36003Alaan TV
ParticipantAnd 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?May 13, 2022 at 2:06 PM #36008Alaan TV
ParticipantI 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:
-
AuthorPosts
Viewing 3 posts - 1 through 3 (of 3 total)
- You must be logged in to reply to this topic.