Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Unyson

    (@unyson)

    all options values (including multi-select) can be get with these functions

    multi-select saves only posts or terms ids, you have to make a db query manually to get data about those ids.

    Thread Starter farid_alfernass

    (@farid_alfernass)

    can you give an example ?

    if i have some codes like this

    'data_slider'        => array(
    						'type'         => 'multi-picker',
    						'label'        => false,
    						'desc'         => false,
    						'value'        => array(
    							'slider_data' => 'latest',
    						),
    						'picker'       => array(
    							'slider_data' => array(
    								'label'   => __( 'Data Slider', 'envalabs' ),
    								'type'    => 'radio',
    								'inline' => true,
    								'choices' => array(
    									'categories'  => __( 'Category', 'envalabs' ),
    									'latest' => __( 'Latest Post', 'envalabs' ),
    									'random' => __( 'Random', 'envalabs' )
    								)
    							)
    						),
    						'choices'      => array(
    							'categories'  => array(
    								'category_selected' => array(
    									'type'    => 'multi-select',
    									'label'   => __( 'Category', 'envalabs' ),
    									'population' => 'taxonomy',
    									'source'     => 'category',
    								)
    							),
    							'latest'  => array(
    								'last_post' => array(
    									'type'    => 'multi-select',
    									'label'   => __( 'Last Post from', 'envalabs' ),
    									'population' => 'users',
    									'source'     => array( 'editor', 'subscriber', 'author', 'contributor', 'administrator' ),
    								)
    							)
    						),
    						'show_borders' => false,
    					),

    I want to get the value that I selected at multi-picker, and got it the value of the multi-select from categories eg

    Plugin Author Unyson

    (@unyson)

    https://manual.unyson.io/en/latest/options/built-in-option-types.html#multi-picker-get-db-value

    $picked = fw_get_db_..._option('data_slider/slider_data');
    $value = fw_get_db_..._option('data_slider/'. $picked);
    
    if ($picked === 'categories') {
    	// $value['category_selected'] ...
    } elseif ($picked === 'latest') {
    	// $value['last_post'] ...
    } elseif ($picked === 'random') {
    	// ...
    }
    Thread Starter farid_alfernass

    (@farid_alfernass)

    thanks, it’s work

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘theme option – how to get value from multi-select’ is closed to new replies.