Forum Replies Created
-
AuthorPosts
-
May 13, 2022 at 2:06 PM in reply to: ✅Can't see the fields group title in the settings page tab #36008
Alaan 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:
May 13, 2022 at 7:06 AM in reply to: ✅Can't see the fields group title in the settings page tab #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?Alaan TV
ParticipantI find a way to get the
$argsof an existing custom post type.I tried first to use the
get_post_types()function, but it was always listing the built-in post types even when I pass the'_builtin' => falsein the function args like this:$args = array( '_builtin' => false ); $post_types = get_post_types( $args );
I found that we can use
global $wp_post_typeslike this:
$wp_post_types['custom_post_type_slug']->arg_slug;.For example:
$wp_post_types['custom_post_type_slug']->labels; $wp_post_types['custom_post_type_slug']->menu_icon; $wp_post_types['custom_post_type_slug']->show_in_menu; ...
Alaan TV
ParticipantWhat I meant was to get the
$argsafter registering the custom post type.Is there any WordPress or MetaBox function that returns the
$argsof a certain registered custom post type?In my example, I need to get the
'show_in_menu'value.Alaan TV
ParticipantI just need a way to get the
$argsof my custom post types. Please help!Alaan TV
ParticipantThank you! I added that line manually and it worked!
-
AuthorPosts