Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Should be able to. Just need to query for the options and construct an array in the right format for the select metabox field.

    I believe the format is an array of arrays, with a field name/field value pairing.

    $options = array(
        array( 'option_1' => 'Option 1' ),
        array( 'option_2' => 'Option 2' ),
    );

    Though I’d check the documentation to make sure. Just need to fetch the options by your preferred way to get the above.

    Thread Starter angelmoskera

    (@angelmoskera)

    Hi Michael, thanks for your answer and sorry for the late reply.

    I added the callback function to my select metabox.
    and this is the functions itself

    function show_doctor_options( ) {
        $thedoctor = pgsa_get_option( 'doctor_name' );
        return $thedoctor;
    }

    This works, but not properly, i can see the option values in the select metabox when creating a new post but when i print the Select metabox on a template, only show the key of the value on the array.

    What i’m doing wrong? can you give an example code pleaseee :'(

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    I’m going to need to know what is assigned in the $thedoctor variable to better help with that. It may not be returning the data in a way that CMB2 is expecting, in order to work properly.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Populate a Select metabox with options from repeteable text field’ is closed to new replies.