• Thank you for your help so far ??
    I work with fields “image-select”. He wants to associate them with a specific theme.
    I have this code:

    array (
    'id' => 'layout',
    'name' => __ ('Icons', 'my-theme'),
    'type' => 'image_select'
    // Array of 'value' => 'Image Source' pairs
    'options' => array (
    '/img/icon-1.png' => '/img/icon-1.png'
    '/img/icon-2.png' => '/img/icon-2.png'
    '/img/icon-3.png' => '/img/icon-3.png'
    '/img/icon-4.png' => '/img/icon-4.png'
    )
    )
    )

    I wish that the images were uploaded from local links. So I changed the file image-select.php adding get_stylesheet_directory_uri () line:

    $tpl  = '<label class="rwmb-image-select"><img src="'. get_stylesheet_directory_uri() . '%s"><input type="%s" class="hidden" name="%s" value="%s"%s></label>';

    and I put in the files of the page/post:

    <?php $my_metabox_1 = rwmb_meta('checkbox_1'); ?>
    <?php if ($my_metabox_1) echo '<img src="'.get_template_directory_uri() .''.rwmb_meta('layout').'">' ;?>

    And everything works very well. ??
    But … when I update the plugin is my change in image-select.php file will be overwritten.
    Do you know any way that allowed to avoid overwriting this correction?

    Thank you for your help.
    Jack

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

  • The topic ‘"image-select" – local links’ is closed to new replies.