Viewing 4 reply threads
  • Author
    Posts
    • #2454

      I would like to produce a metabox that has a first name and a last name field inline on the same row. Is that possible? I can’t find any way to do it in the documentation.

      Lewis

    • #2455
      Jason
      Keymaster

      Greetings!

      Try this:

      piklist('field', array(
        'type'    => 'group',
        'field'   => 'name',
        'label'   => 'Name',
        'fields'  => array(
          array(
            'type'    => 'text',
            'field'   => 'first',
            'label'   => 'First',
            'columns' => 5
          ),
          array(
            'type'    => 'text',
            'field'   => 'last',
            'label'   => 'Last',
            'columns' => 5
          )
        )
      ));

      You’ll notice that each field in the group has a “columns” value. This is on a grid of 12. So if you have two fields whose columns sum are >= 12, they’ll appear on the same row.

      Hope this helps! 🙂

    • #2458
      Steve
      Keymaster

      @jason– 5+5=10, not 12 😉

      should be

      'columns' => 6
      
    • #2459
      Steve
      Keymaster

      @jason– 5+5=10, not 12 😉

      should be

      'columns' => 6
      
    • #2467
      Jason
      Keymaster

      Oh, hahah! I automatically set the columns according to the width I’d use for first/last names inside of a group. Full width tends to look like too much for fields that merit a short answer.

      But, yes, we can definitely agree that 5 + 5 = 10. Let it be so. 🙂

Viewing 4 reply threads
  • The topic ‘Inline fields’ is closed to new replies.