Ver Mensaje Individual
  #1 (permalink)  
Antiguo 10/11/2013, 06:32
bpsysoficial
 
Fecha de Ingreso: junio-2010
Mensajes: 14
Antigüedad: 13 años, 10 meses
Puntos: 0
salto de linea al procesar un get_post_meta

Hola amigos les comento que cree un campo personalizado para insertar enlaces de descargas en el, que es el siguiente:

Código PHP:
Ver original
  1. add_action('admin_init', 'mega_add_custom_box', 1);
  2. function mega_add_custom_box() {
  3.     add_meta_box(
  4.         'id_mega',
  5.         'URL MEGA',
  6.         'wp_box_mega',
  7.         'post'
  8.     );
  9. }
  10.  
  11. function wp_box_mega($post) {
  12. wp_nonce_field(plugin_basename(__FILE__), 'mega_noncename');
  13. if($_GET['action']=='edit'){
  14. $mega=get_post_meta($post->ID,'mega',true);
  15. echo'<textarea name="mega" style="width:100%"/>'.$mega.'</textarea>';
  16. }else{
  17. echo'<textarea name="mega" style="width:100%"/></textarea>';   
  18. }
  19. }
  20.  
  21. add_action('save_post', 'guardar_mega');
  22.  
  23. function guardar_mega($post_id){
  24.   if ( !wp_verify_nonce( $_POST['mega_noncename'], plugin_basename(__FILE__) ) )
  25.       return $post_id;
  26.  
  27.   if ( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE )
  28.       return $post_id;
  29.  
  30.    
  31.   if ( !current_user_can( 'edit_post', $post_id ) )
  32.         return $post_id;
  33.  
  34. delete_post_meta($post_id, 'mega');
  35. if(!empty($_POST['mega'])){
  36.   add_post_meta($post_id, 'mega', esc_attr($_POST['mega']));
  37. }
  38.  
  39. }

y para recuperar lo que ingreso en ese textarea en mi single.php utilizo:

Código PHP:
Ver original
  1. <?php echo get_post_meta(get_the_ID(), 'mega', true); ?>

el problema esta en que aunque yo ingrese los enlaces uno debajo de el otro en el textarea, en el post se ven todos en la misma linea, unas imágenes para que vean:




hay alguna forma de hacer que el texto salga un enlace debajo del otro como lo ingreso en el textarea?