Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

194
Views
Cómo mostrar la carga de medios de wordpress de imagen en otro complemento

Agregué un código de función para agregar el botón 'cargar imagen' de la biblioteca de medios a otro archivo de complemento usando el código a continuación. Sin embargo, ¿cómo agrego para mostrar la imagen cargada o mostrar la URL de la imagen seleccionada de la biblioteca de medios después de enviarla? No estoy seguro de si esto requiere js adicionales para mostrar en el cuadro meta. ingrese la descripción de la imagen aquí

Después de 'agregar información de seguimiento', ¿cómo agrego la imagen cargada o la URL a continuación? ingrese la descripción de la imagen aquí

 // jQuery wp_enqueue_script('jquery'); // This will enqueue the Media Uploader script wp_enqueue_media(); ?> <div> <label for="image_url">Image</label> <input type="text" name="image_url" id="image_url" class="regular-text"> <input type="button" name="upload-btn" id="upload-btn" class="button-secondary" value="Upload Image"> </div> <script type="text/javascript"> jQuery(document).ready(function($){ $('#upload-btn').click(function(e) { e.preventDefault(); var image = wp.media({ title: 'Upload Image', // mutiple: true if you want to upload multiple files at once multiple: false }).open() .on('select', function(e){ // This will return the selected image from the Media Uploader, the result is an object var uploaded_image = image.state().get('selection').first(); // We convert uploaded_image to a JSON object to make accessing it easier // Output to the console uploaded_image console.log(uploaded_image); var image_url = uploaded_image.toJSON().url; // Let's assign the url value to the input field $('#image_url').val(image_url); }); }); }); </script>
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!