black friday sale

Custom Fields
Support MB Relationships turn Mb Relationships as Field and make 1 to many relationships

  • Creator
  • #10610

    for this version mb relationships can only implement by add extra php code then plugin pop another metabox for Post edit to connect another object

    but it would be good if this extension can turn into Field Type Like “Post Field” and more options for relationships like

    multiple > false for 1 to many relationships or required field

    thx 😀

Viewing 2 replies - 1 through 2 (of 2 total)
  • Author
  • #10617
    Anh Tran

    Good idea :). I’ll save this idea into my notes.


    anyway I want to share my code to make Mb Relationships can select only single value


    search for function


    put these code under line

    $field['name'] = $this->to['meta_box']['field_title'];

    like this

    $field['name'] = $this->to['meta_box']['field_title'];
    $field['clone'] = $this->to['clone'];// <<< option to selective clone on/off
    $field['attributes']['required'] = $this->to['attributes']['required']; // set it required field

    now we can use clone = false option

    like this :

    'to' => array(
            'object_type' => 'post',
            'post_type'   => 'gallery',
             'admin_column' => 'after title', // THIS!
             'clone' => false, // <<<< add this line for turn off clone 
              'attributes' => array(     // <<< for make field required
            'required' => true,  // <<< for make field required
          ),  // <<< for make field required
            'meta_box'    => array(
                    'context' => 'normal',
Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.