• Resolved seweral

    (@seweral)


    How to make the selected picture showed is also on the front?
    so I changed the code

    <?php
    add_filter( 'rwmb_meta_boxes', 'prefix_register_meta_box_image_select' );
    function prefix_register_meta_box_image_select( $meta_boxes )
    {
    	$meta_boxes[] = array(
    		'title' => __( 'Image Select Demo', 'meta-box', 'meta-box' ),
    		'fields' => array(
    			array(
    				'id'       => 'layout',
    				'name'     => __( 'Layout', 'meta-box' ),
    				'type'     => 'image_select',
    				'multiple' => true,
    				// Array of 'value' => 'Image Source' pairs
    				'options'  => array(
    					'https://placehold.it/90x90&text=Left' => 'https://placehold.it/90x90&text=Left',
    					'https://placehold.it/90x90&text=Right' => 'https://placehold.it/90x90&text=Right',
    					'https://placehold.it/90x90&text=None' => 'https://placehold.it/90x90&text=None',
    					'https://placehold.it/90x90&text=One' => 'https://placehold.it/90x90&text=One',
    				),
    				// Allow to select multiple values? Default is false
    				// 'multiple' => true,
    			),
    		),
    	);
    	return $meta_boxes;
    }

    but after saving, the result is not stored.
    Do you have any ideas?
    Thank you for your help.

    https://www.ads-software.com/plugins/meta-box/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Anh Tran

    (@rilwis)

    Hi,

    You can use the helper function to display images, like this:

    $images = rwmb_meta( 'layout', 'multiple=1' );
    foreach ( $images as $image )
    {
        echo '<img src="' . $image . '">';
    }
    Thread Starter seweral

    (@seweral)

    Hi,
    Thank you very much for your quick reply.
    You helped me a lot.

    Best regards

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘"image-select" – selected thumbnail on the front’ is closed to new replies.