/** * Append the template for the attachment upload placeholder to the body of the page * for later use. * * @since 0.4.0 */ function ev_attachment_upload_placeholder_templates() { /* Image upload template. */ echo '<script type="text/template" data-template="ev-attachment-placeholder">'; echo '<span class="ev-sortable-handle"></span>'; printf(ev_attachment_upload_generic_placeholder_template(), '{{ type }}', __('Remove', 'ev_framework'), '{{ id }}', '{{ title }}', '{{ url }}', '{{ extension }}'); echo '</script>'; }
$type = ''; if (wp_attachment_is_image($id)) { $type = 'image'; } elseif (wp_attachment_is('audio', $id)) { $type = 'audio'; } elseif (wp_attachment_is('video', $id)) { $type = 'video'; } else { $check = wp_check_filetype($file); if (isset($check['ext'])) { $type = $check['ext']; } else { $type = 'unknown'; } } printf(ev_attachment_upload_generic_placeholder_template(), esc_attr($type), esc_html(__('Remove', 'ev_framework')), esc_attr($id), esc_html($title), esc_attr(wp_get_attachment_url($id)), esc_html($extension)); } } ?> <div class="ev-attachment-upload-action"> <a href="#" class="ev-edit-action"><?php esc_html_e('Edit', 'ev_framework'); ?> </a> <a href="#" class="ev-upload-action"><?php esc_html_e('Upload', 'ev_framework'); ?> </a> <?php if ($multiple) {