• Resolved noski2009

    (@noski2009)


    Have looked everywhere and I can’t find any CMB2 documentation that outlines how I can get the following to display on the front end. Does anyone know how to echo out a simple select dropdown to the front end, thanks?

          add_action( 'cmb2_admin_init', 'cmb2_select_size_metaboxes' );
    
          function cmb2_select_size_metaboxes() {
    
            $cmb = new_cmb2_box( array(
                'id'            => 'size_metabox',
                'title'         => __( 'Select Size', 'cmb2' ),
                'object_types'  => array( 'product', ), // Post type'context'       => 'normal',
                'priority'      => 'high',
              'type'             => 'select',
                'show_option_none' => true,
                'default'          => 'custom',
                'options'          => array(
                    'standard' => __( 'Option One', 'cmb2' ),
                    'custom'   => __( 'Option Two', 'cmb2' ),
                    'none'     => __( 'Option Three', 'cmb2' ),
                ),
            ) );
          }
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to display a select dropdown’ is closed to new replies.