Ver Mensaje Individual
  #6 (permalink)  
Antiguo 01/06/2011, 08:28
Avatar de Omegakenshin
Omegakenshin
 
Fecha de Ingreso: junio-2010
Ubicación: Costa Rica
Mensajes: 156
Antigüedad: 16 años, 4 meses
Puntos: 22
Información Respuesta: Metadata y arrays en wordpress - Facil

Gracias abimaelrc, ok ahora el problema k tengo es para mostrar las variables correctamente, y guardarlas en wordpress, sera k hay algo mal en mi codigo, te muestro.

Código PHP:
<? function files_metadata(){  
        global 
$post; 
        
$custom = get_post_custom($post->ID);  
        
$name = $custom["name"][0];
        
$url = $custom["url"][0];
        
$url2 = $custom["url"][1];
        
$url3 = $custom["url"][2];

        echo 
'<input type="hidden" name="files_metadata" id="files_metadata" value="' .wp_create_nonce('files_m'). '" />'; ?>  

<label>Name: </label><br/>
<input id="name" name="name" value="<?php echo $name; ?>" />
<label>Url: </label><br/>
<input id="url" name="url[0]" value="<?php echo $url; ?>" />
<input id="url2" name="url[1]" value="<?php echo $url2; ?>" />
<input id="url3" name="url[2]" value="<?php echo $url3; ?>" />

<? function save_meta_files($post_id) {  
        if (!
wp_verify_nonce($_POST['files_metadata'], 'files_m')) return $post_id;
        if (
defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) return $post_id;

        
update_post_meta($post_id, "name", $_POST["name"]);   
        
update_post_meta($post_id, "url", $_POST["url"][0]); 
        
update_post_meta($post_id, "url2", $_POST["url"][1]); 
        
update_post_meta($post_id, "url3", $_POST["url"][2]);
    }  

add_action('save_post', 'save_meta_files'); ?>

Última edición por Omegakenshin; 01/06/2011 a las 08:29 Razón: pequeño error