Custom Fields
Re-Envisioned
Support Meta Box Group Post title instead of ID

  • Creator
    Topic
  • #30850
    Resolved toni bird
    Participant

    Hi guys , Was wondering if its possible to save the post title into my group array , not the ID as shown bold below:

    a:2:{i:0;a:3:{s:7:"staff_d";s:4:"7151";s:11:"staff_d_qtd";s:1:"1";s:10:"sd_factorx";s:1:"9";}i:1;a:3:{s:7:"staff_d";s:4:"7153";s:11:"staff_d_qtd";s:1:"1";s:10:"sd_factorx";s:1:"9";}}

    My group code below

     [
                    'id'      => $prefix . 'rev_staff',
                    'type'    => 'text',
                    'name'    => "###ATEN\xc3\x87\xc3\x83O - Itens listados aqui devem ser revisados.###",
                    'size'    => 160,
                    'columns' => 12,
                    'tab'     => 'staff_tab',
                ],
                [
                    'id'            => $prefix . 'group_staff_d',
                    'type'          => 'group',
                    'name'          => esc_html__( 'DIRETO', 'text-domain' ),
                    'fields'        => [
                        [
                            'id'         => $prefix . 'staff_d',
                            'type'       => 'post',
                            'name'       => "###Fun\xc3\xa7\xc3\xa3o###",
                            'post_type'  => ['efetivo'],
                            'field_type' => 'select_advanced',
                            'columns'    => 4,
                        ],
                        [
                            'id'      => $prefix . 'staff_d_qtd',
                            'name'    => esc_html__( 'Quantidade', 'text-domain' ),
                            'type'    => 'select',
                            'options' => [
                                '' => esc_html__( '', 'text-domain' ),
                                1  => esc_html__( '1', 'text-domain' ),
                                2  => esc_html__( '2', 'text-domain' ),
                                3  => esc_html__( '3', 'text-domain' ),
                                4  => esc_html__( '4', 'text-domain' ),
                                5  => esc_html__( '5', 'text-domain' ),
                                6  => esc_html__( '6', 'text-domain' ),
                                7  => esc_html__( '7', 'text-domain' ),
                                8  => esc_html__( '8', 'text-domain' ),
                                9  => esc_html__( '9', 'text-domain' ),
                                10 => esc_html__( '10', 'text-domain' ),
                                11 => esc_html__( '11', 'text-domain' ),
                                12 => esc_html__( '12', 'text-domain' ),
                                13 => esc_html__( '13', 'text-domain' ),
                                14 => esc_html__( '14', 'text-domain' ),
                                15 => esc_html__( '15', 'text-domain' ),
                            ],
                            'columns' => 3,
                            'visible' => [
                                'when'     => [['staff_d', '!=', '']],
                                'relation' => 'and',
                            ],
                        ],
                        [
                            'id'            => $prefix . 'sd_factorx',
                            'name'          => esc_html__( 'HHT', 'text-domain' ),
                            'type'          => 'select',
                            'std'           => 9,
                            'options'       => [
                                '' => esc_html__( '', 'text-domain' ),
                                1  => esc_html__( '1', 'text-domain' ),
                                2  => esc_html__( '2', 'text-domain' ),
                                3  => esc_html__( '3', 'text-domain' ),
                                4  => esc_html__( '4', 'text-domain' ),
                                5  => esc_html__( '5', 'text-domain' ),
                                6  => esc_html__( '6', 'text-domain' ),
                                7  => esc_html__( '7', 'text-domain' ),
                                8  => esc_html__( '8', 'text-domain' ),
                                9  => esc_html__( '9', 'text-domain' ),
                                10 => esc_html__( '10', 'text-domain' ),
                                11 => esc_html__( '11', 'text-domain' ),
                                12 => esc_html__( '12', 'text-domain' ),
                                13 => esc_html__( '13', 'text-domain' ),
                                14 => esc_html__( '14', 'text-domain' ),
                                15 => esc_html__( '15', 'text-domain' ),
                            ],
                            'columns'       => 3,
                            'required'      => 1,
                            'clone_default' => true,
                            'visible'       => [
                                'when'     => [['staff_d_qtd', '!=', '']],
                                'relation' => 'and',
                            ],
                        ],
                    ],
                    'clone'         => 1,
                    'default_state' => 'expanded',
                    'group_title'   => '{staff_d} : {staff_d_qtd}',
                    'clone_default' => true,
                    'tab'           => 'staff_tab',
                ],

    My problems is, that in views when I use :

    <?php foreach ($staff_d_array as $row): array_map('htmlentities', $row); ?>
        <tr  style="border-bottom: 1px solid #ddd; word-break:normal">
          <td ><?php echo implode('</td><td>', $row); ?></td>
    

    is showing the ID not post title , many thanks

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