Ver Mensaje Individual
  #6 (permalink)  
Antiguo 08/11/2011, 09:12
MadDunDee
 
Fecha de Ingreso: octubre-2006
Mensajes: 199
Antigüedad: 17 años, 6 meses
Puntos: 3
Respuesta: Novato Wordpress; image-attachment

Hola de nuevo, estoy planteando este tema a partir de esta aproximación. Pero no soy capaz de hacerla funcionar correctamente:

Código PHP:
function get_img_attached(){
global 
$post;
$args = array(
    
'numberposts' => null,
    
'post_parent' => $post->ID,
    
'post_type' => 'attachment',
    
'nopaging' => false,
    
'post_mime_type' => 'image',
    
'order' => 'ASC',
    
'orderby' => 'menu_order ID',
    
'post_status' => 'any'
);

            
$imageID $attachment->ID;
            
$imageTitle $attachment->post_title;
            
$imageCaption $attachment->post_excerpt;
            
$imageDescription $attachment->post_content;
            
$imageAlt get_post_meta($imageID'_wp_attachment_image_alt'true);
            
$imageArray wp_get_attachment_image_src($attachment_value$sizefalse);
            
$imageURI $imageArray[0]; 
            
$imageWidth $imageArray[1];
            
$imageHeight $imageArray[2];

            
// Construir el marcado
            
$imgAtt '<figure class="content-image><a href="' get_permalink() . '" title="' the_title(""""false) . '"><img src="' $imageURI '" width="' $imageWidth '" height="' $imageHeight '" alt="' $imageAlt '" title="' $imageTitle '" /></a><figcaption>.'$imageCaption'.<small><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/">Licencia Creative Commons Attribution Share-alike</a></small>';
            
// escribir la cadena
            
echo $imgAtt;
}

unset(
$args);} 
Luego a continuación, en el loop, lanzo la función.

Código PHP:
<?php get_img_attached(); ?>
El caso es que no consigo hacerlo funcionar de ningún modo, a alguien se le ocurre cómo hacerlo?

Muchas gracias!