public function render_content() { TitanFrameworkOptionUpload::createUploaderScript(); $previewImage = ''; $value = $this->value(); if (is_numeric($value)) { // Gives us an array with the first element as the src or false on fail. $value = wp_get_attachment_image_src($value, array(150, 150)); } if (!is_array($value)) { $value = $this->value(); } else { $value = $value[0]; } if (!empty($value)) { $previewImage = "<i class='dashicons dashicons-no-alt remove'></i><img src='" . esc_url($value) . "' style='display: none'/>"; } ?> <div class='tf-upload'> <span class="customize-control-title"><?php echo esc_html($this->label); ?> </span> <div class='thumbnail tf-image-preview'><?php echo $previewImage; ?> </div> <input type='hidden' value="<?php echo esc_attr($this->value()); ?> " <?php $this->link(); ?> /> </div> <?php if (!empty($this->description)) { echo "<p class='description'>{$this->description}</p>"; } }
public function render_content() { TitanFrameworkOptionUpload::createUploaderScript(); $previewImage = ''; $value = $this->value(); if (!empty($value)) { $previewImage = "<img src='" . esc_attr($this->value()) . "'/>"; } ?> <label> <span class="customize-control-title"><?php echo esc_html($this->label); ?> </span> <div class='thumbnail tf-theme-customizer'><?php echo $previewImage; ?> </div> <input class='tf-theme-customizer-input' type='text' value="<?php echo esc_attr($this->value()); ?> " <?php $this->link(); ?> /> <p class='description'><button class='button-secondary upload tf-upload-image'>Upload</button> <a href="#" class="remove tf-upload-image-remove" style='<?php echo empty($value) ? "display: none" : ''; ?> '>Remove</a></p> </label> <?php echo "<p class='description'>{$this->description}</p>"; }