Relationship box won't show up below costom fields

Support MB Relationships Relationship box won't show up below costom fieldsResolved

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #33568
    danieldkdanieldk
    Participant

    I have a relationship defined that works as I want, except it shows up below the custom fields on one side of the relationship, but not on the other side.

    I have tried to put the context = normal in different places, and it just doesn't move away from the sidebar.

    add_action('mb_relationships_init', function () {
        MB_Relationships_API::register([
            'id'   => 'djs_to_events',
            'from' => array(
                'post_type' => 'tmd_dj',
                'admin_columns' => array(
                    'position'   => 'after title',
                    'title'      => 'Events',
                ),
                'empty_message' => 'No DJs connected',
                'context' => 'normal',
    
                'meta_box' => array(
                    'id' => 'event_selection',
                    'name' => 'Events',
                    'title' => 'Events this DJ played at',
                    'context' => 'normal',
                    'class'   => 'event_selection',
                ),
                'field'         => array(
                    'context' => 'advanced',
                    'name'        => 'DJs playing in this event',
                    'label_description' => '',
                    'placeholder' => 'Select DJs',
                    'add_button'  => 'Add another Event',
                ),
    
            ),
            'to'   => array(
                'post_type' => 'tmd_event',
                'empty_message' => 'No events connected',
    
                'admin_columns' => array(
                    'position'   => 'after title',
                    'title'      => 'DJs',
                ),
                'context' => 'advanced',
                'meta_box' => array(
                    'id' => 'dj_selection',
                    'name' => 'DJs',
                    'title' => 'Select DJs',
                    'context' => 'advanced',
                    'class'   => 'dj_selection',
                ),
                'field'         => array(
                    'context' => 'advanced',
                    'name'              => 'This DJs played at the linked events',
                    'label_description' => '',
                    'desc'              => 'Not all events are usually linked, but we try our best.',
                    'add_button'        => 'Link with another event',
                ),
    
            ),
    
        ]);
    });
    
    #33604
    Long NguyenLong Nguyen
    Moderator

    Hi,

    The setting context of meta box works as well on my site, here is the screenshot https://monosnap.com/file/8SU74JQCpxclzDMPqWSHJfHg9mZ8YG

    Code:

    function your_prefix_function_name() {
        MB_Relationships_API::register( [
            'id'   => 'job-to-post',
            'from' => 'job',
            'to'   => [
                'object_type' => 'post',
                'post_type'   => 'post',
                'meta_box'    => [
                    'context' => 'normal',
                ],
            ],
        ] );
    }
    #33630
    danieldkdanieldk
    Participant

    Here's my minimal definition of the relationship.

    Moving the metabox into the main column works only on the FROM side, but not on the TO side.
    Is that the intention, or a bug?

    add_action('mb_relationships_init', function () {
        MB_Relationships_API::register([
            'id'   => 'djs_to_events',
            'from' => array(
                'post_type' => 'tmd_dj',
                'meta_box' => array(
                    'context' => 'normal',
                ),
            ),
            'to'   => array(
                'post_type' => 'tmd_event',
                'meta_box' => array(
                    'context' => 'normal',
                ),
            ),
        ]);
    });
    
    #33631
    danieldkdanieldk
    Participant

    Ha! I am getting closer: looks like there is user meta data that was stored in my database about the location of metaboxes.

    Is there a way to delete these settings using metabox AIO?

    #33684
    Long NguyenLong Nguyen
    Moderator

    Hi,

    No, it is not possible to change the meta box location (order) of user data with MB AIO. You can drag and drop the meta box relationship to re-order it and save the post to update the user data.

    Tip: use Classic Editor for drag and drop meta boxes easier https://wordpress.org/plugins/classic-editor/

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.