Ver Mensaje Individual
  #6 (permalink)  
Antiguo 18/11/2015, 11:11
Avatar de ArturoGallegos
ArturoGallegos
Moderador
 
Fecha de Ingreso: febrero-2008
Ubicación: Morelia, México
Mensajes: 6.774
Antigüedad: 16 años, 2 meses
Puntos: 1146
Respuesta: custom post type o plugin o wp customize control

Aquí esta el código que yo uso para wp.media
Código PHP:
Ver original
  1. wp_enqueue_script('admin-js', $this->root.'assets/js/scripts.js',array('jquery'), null, true);
  2.         wp_enqueue_media();
Código Javascript:
Ver original
  1. $('.add-img-taxonomy span.add').click(function(){
  2.         var input = $(this).parent().find('input');
  3.         var frame = wp.media({
  4.             title : 'Seleccionar imagen',
  5.             multiple : false,
  6.             library : {type:'image'},
  7.             button : {text:'Seleccionar imagen'}
  8.         });
  9.         frame.on('select',function() {
  10.             selection = frame.state().get('selection');
  11.             selection.map(function(attachment){
  12.                 attachment = attachment.toJSON();
  13.                 input.val(attachment['url']);
  14.             });
  15.         });
  16.         frame.open();
  17.     });

Ojala que te sirva.