Addable popup template when using multi picker
Hi,
I am trying to use an addable popup option. Inside the popup there is a multi picker. I am looking to use the value of the selected multi picker option for the template. (as in the value that is shown for each addable popup when it is closed.
So in the below code, I want to use:
'0' => __('Extra Widget Section', 'unyson'), '1' => __('Logo / Navigation Section', 'unyson'), '2' => __('Featured Posts Slider', 'unyson'), '3' => __('Featured Posts Slider (text only)', 'unyson'), '4' => __('Featured Posts Grid', 'unyson'), '5' => __('Extra Editor Area', 'unyson'),
Depending on what the user picks, for this 'template'.
i.e. {{- opt_header_element_type }} isn't displaying the selected item though, I guess because its nested another level down.
Any ideas how to target the contents of these for the template section? (code below).
/*addable popup*/
'demo_addable_popup' => array(
'label' => __( 'Addable Popup', 'unyson' ),
'type' => 'addable-popup',
'desc' => __( 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
'unyson' ),
'template' => '{{- opt_header_element_type }}',
'popup-options' => array(
'opt_header_element_type' => array(
'type' => 'multi-picker',
'label' => false,
'desc' => false,
'picker' => array(
'template' => array(
'label' => __( 'Override Header Functionality For This Post', 'unyson' ),
'type' => 'select',
'choices' => array(
'0' => __('Extra Widget Section', 'unyson'),
'1' => __('Logo / Navigation Section', 'unyson'),
'2' => __('Featured Posts Slider', 'unyson'),
'3' => __('Featured Posts Slider (text only)', 'unyson'),
'4' => __('Featured Posts Grid', 'unyson'),
'5' => __('Extra Editor Area', 'unyson'),
),
'desc' => __( 'Optionally override the header functionality for this post',
'unyson'
),
)
),
@splendidbob why you use multi-picker as a simple select ,please read the documentation how work multi-picker, for your case you can use select option type.Soon I will answer how you can use template.
@splendidbob watch this video.
Hi, thanks.
Multi-picker was used because there are further nested options under each choice (I just didn't paste all of the code).
I follow the video, but is there any way to get the value rather than id? it seems in the multi picker you can't use anything other than sequential numbers for the id's or the option won't show.
Not a biggie if it can't be done, as I can use addable box instead, but popup would be more ideal because it takes up less space.
cheers
Ah, nvm, I have text working in the key now :) cheers