Support Forum » User Profile

Forum Replies Created

Viewing 6 posts - 31 through 36 (of 36 total)
  • Author
    Posts
  • Alaan TVAlaan TV
    Participant

    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:

    Show the title of a fields gruop in a settings page tab

    Alaan TVAlaan TV
    Participant

    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?

    in reply to: How to get the args of my custom post types #35994
    Alaan TVAlaan TV
    Participant

    I find a way to get the $args of 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' => false in the function args like this:

    $args = array(
       '_builtin' => false
    );
    $post_types = get_post_types( $args );
    

    I found that we can use global $wp_post_types like 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;
    ...
    
    in reply to: How to get the args of my custom post types #35991
    Alaan TVAlaan TV
    Participant

    What I meant was to get the $args after registering the custom post type.

    Is there any WordPress or MetaBox function that returns the $args of a certain registered custom post type?

    In my example, I need to get the 'show_in_menu' value.

    in reply to: How to get the args of my custom post types #35986
    Alaan TVAlaan TV
    Participant

    I just need a way to get the $args of my custom post types. Please help!

    in reply to: Tab custom fields don't appear when using the code #35709
    Alaan TVAlaan TV
    Participant

    Thank you! I added that line manually and it worked!

Viewing 6 posts - 31 through 36 (of 36 total)