Custom Fields
Re-Envisioned
Support MB Custom Post Type Different CPT fields showing in my CPT

This topic contains 3 replies, has 2 voices, and was last updated by  Anh Tran 2 weeks, 1 day ago.

  • Creator
    Topic
  • #16294

    John Anderson
    Participant

    Hi,
    Apologies if this is a dumb question but it has me stumped.

    I have created a CPT called team_members it contains singular information about each person in the team. But when I go to add/update a team_member entry I see an additional field at the top (below title) and I don’t know where this comes from.

    Can you help me? I’ve included a video that might help.

    Thanks,
    John.

    http://somup.com/cqQTr8emnw

Viewing 3 replies - 1 through 3 (of 3 total)
  • Author
    Replies
  • #16310

    Anh Tran
    Keymaster

    Hi John,

    Can you please check if the meta box is defined in the code? That’s the only reason I can think of.

    PS: Your voice is nice to hear, very clear!

    #16322

    John Anderson
    Participant

    Hello Anh,

    Thank you. That is an Australian voice!

    Below is the code for the custom fields for the CPT ‘team-member’. ‘team_position’ is only used once, but it is linking to a taxonmy called ‘team-positions’. Could this be the issue?

    John.

    add_filter( 'rwmb_meta_boxes', 'your_prefix_register_meta_boxes' );
    
    function your_prefix_register_meta_boxes( $meta_boxes ) {
        $prefix = '';
    
        $meta_boxes[] = array (
            'title' => esc_html__( 'Team Member', 'text-domain' ),
            'id' => 'team-member',
            'post_types' => array(
                0 => 'team-member',
            ),
            'context' => 'after_title',
            'priority' => 'high',
            'fields' => array(
                array (
                    'id' => $prefix . 'heading_n402g7bza5',
                    'type' => 'heading',
                    'desc' => esc_html__( 'Information about this Individual', 'text-domain' ),
                    'name' => esc_html__( 'Individual Header', 'text-domain' ),
                ),
                array (
                    'id' => $prefix . 'team_summary',
                    'type' => 'textarea',
                    'name' => esc_html__( 'Summary', 'text-domain' ),
                ),
                array (
                    'id' => $prefix . 'team_title',
                    'type' => 'text',
                    'name' => esc_html__( 'Title or job description', 'text-domain' ),
                ),
                array (
                    'id' => $prefix . 'team_position',
                    'type' => 'taxonomy',
                    'name' => esc_html__( 'Position', 'text-domain' ),
                    'desc' => esc_html__( 'This is the team member position in a general sense.   This is not specific to their role in any Challenge.', 'text-domain' ),
                    'taxonomy' => 'team_positions',
                    'field_type' => 'checkbox_tree',
                ),
                array (
                    'id' => $prefix . 'team_individual_url',
                    'type' => 'url',
                    'name' => esc_html__( 'Individual URL', 'text-domain' ),
                    'desc' => esc_html__( 'Link to this person\'s page / bibilography', 'text-domain' ),
                ),
                array (
                    'id' => $prefix . 'team_email',
                    'name' => esc_html__( 'Email Address', 'text-domain' ),
                    'type' => 'email',
                    'desc' => esc_html__( 'Email Address for this individual', 'text-domain' ),
                ),
                array (
                    'id' => $prefix . 'team_facebook',
                    'type' => 'url',
                    'name' => esc_html__( 'facebook', 'text-domain' ),
                    'desc' => esc_html__( 'facebook link', 'text-domain' ),
                ),
                array (
                    'id' => $prefix . 'team_twitter_handle',
                    'type' => 'text',
                    'name' => esc_html__( 'Twitter Handle', 'text-domain' ),
                ),
                array (
                    'id' => $prefix . 'heading_sigt24rh4qc',
                    'type' => 'heading',
                    'desc' => esc_html__( 'Organisation', 'text-domain' ),
                    'name' => esc_html__( 'team_organisation', 'text-domain' ),
                ),
                array (
                    'id' => $prefix . 'team_organisation_name',
                    'type' => 'text',
                    'name' => esc_html__( 'Organisation Name', 'text-domain' ),
                    'desc' => esc_html__( 'Name of the organisation this person represents', 'text-domain' ),
                ),
                array (
                    'id' => $prefix . 'team_organisation_logo',
                    'type' => 'single_image',
                    'name' => esc_html__( 'Organisation Logo', 'text-domain' ),
                    'desc' => esc_html__( 'the image that will be the organisation logo', 'text-domain' ),
                ),
                array (
                    'id' => $prefix . 'team_organisation_url',
                    'type' => 'url',
                    'name' => esc_html__( 'Organisation URL', 'text-domain' ),
                    'desc' => esc_html__( 'URL for the organisation icon link', 'text-domain' ),
                ),
            ),
            'style' => 'seamless',
        );
    
        return $meta_boxes;
    }
    #16346

    Anh Tran
    Keymaster

    Hi John,

    The code above is the code exported from Meta Box Builder, isn’t it? It’s the code for the seamless meta box that we see in the video, which is correct.

    What I meant is maybe there’s some code that registers another meta box with the title “Team Members” (id “team-members”) somewhere. So, please try to do search through your theme/plugin to see if you or someone did that before.

Viewing 3 replies - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.