Visualizzare un'immagine in evidenza (solo URL dell'immagine) come src dell'immagine?
Ho il seguente codice:
if (themedy_get_option('product_gallery')) { add_action('genesis_post_content', 'themedy_product_images', 1); }
function themedy_product_images() { ?>
<?php
global $post;
$images = get_children( array( 'post_parent' => $post->ID, 'post_type' => 'attachment', 'post_mime_type' => 'image', 'numberposts' => 999, 'order'=> 'ASC', 'orderby' => 'menu_order' ) );
if ( $images ) { ?>
<div class="twocol-one">
<?php echo get_the_post_thumbnail( $post->ID, 'product-400x600' ); ?>
<div class="product_images">
<div class="container">
<?php
foreach ( $images as $image ){
$gallery_image_info = wp_get_attachment_image_src( $image->ID, 'full' );
$gallery_image = $gallery_image_info[0];
$gallery_thumb_info = wp_get_attachment_image_src( $image->ID, 'Gallery Thumb' );
$gallery_thumb = $gallery_thumb_info[0];
$gallery_image_alt = get_post_meta($image->ID, '_wp_attachment_image_alt', true) ? trim(strip_tags( get_post_meta($image->ID, '_wp_attachment_image_alt', true) )) : trim(strip_tags( $image->post_title ));
echo '<a href="'.$gallery_image.'" title="'.$gallery_image_alt.'" class="fancybox" rel="single-gallery"><img src="' . $gallery_thumb . '" /></a>';
}
?>
</div>
</div>
</div>
Problema #1: Dove dice:
<?php echo get_the_post_thumbnail( $post->ID, 'product-400x600' ); ?>
Ho bisogno che dica
<a id="product" class="MagicZoomPlus" href=" <?php echo get_the_post_thumbnail( $post->ID, 'large' ); ?> " rel="selectors-class: Active"><img src=" <?php echo get_the_post_thumbnail( $post->ID, 'product-400x600' ); ?> " alt="" /></a>`
Dove fa l'echo delle immagini (large e product-400x600), ho bisogno che faccia l'echo solo dell'URL dell'immagine, senza tutto l'altro HTML che viene generato. Come posso modificare il codice sopra per averlo nel modo che mi serve?
Problema #2: Dove dice:
echo '<a href="'.$gallery_image.'" title="'.$gallery_image_alt.'" class="fancybox" rel="single-gallery"><img src="' . $gallery_thumb . '" /></a>';
È un ciclo di tutte le altre immagini in quella galleria. Per ogni immagine nel ciclo.. Ho bisogno che dica
<a class="Selector" href="<?php echo get_the_post_thumbnail( $post->ID, 'large' ); ?>" rel="zoom-id:product" rev="<?php echo get_the_post_thumbnail( $post->ID, 'medium' ); ?>"><img src="' . $gallery_thumb . '" alt="" /></a>
Di nuovo, stesso problema del #1 dove ho bisogno di fare l'echo solo dell'URL/src dell'immagine.
Il modo in cui dovrebbe funzionare è come in questo esempio: http://www.magictoolbox.com/magiczoomplus/
Grazie in anticipo!
Modifica
Il mio primo tentativo come suggerito da Brian qui sotto per l'immagine in evidenza, funziona!
<?php
$image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full');
$image2 = wp_get_attachment_image_src(get_post_thumbnail_id(), 'product-400x600');
?>
<?php echo '<a id="product" class="MagicZoomPlus" href="'.$image[0].'" rel="selectors-class: Active"><img src="'.$image2[0].'" alt="" /></a>'; ?>
Ora la domanda è, come posso fare questo per gli elementi della galleria immagini?

Ecco le funzioni che devi conoscere:
- http://codex.wordpress.org/Function_Reference/get_post_thumbnail_id
- http://codex.wordpress.org/Function_Reference/wp_get_attachment_url
- http://codex.wordpress.org/Function_Reference/wp_get_attachment_image_src
- http://codex.wordpress.org/Function_Reference/wp_get_attachment_image
Esempio senza dimensione:
echo wp_get_attachment_url(get_post_thumbnail_id());
Esempio con dimensione:
$image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'large');
echo $image[0]; //come HREF nel tuo tag A
Puoi ottenere tutte le immagini della galleria nel seguente modo:
$args = array(
'order'=> 'ASC',
'post_mime_type' => 'image',
'post_parent' => $post->ID,
'post_type' => 'attachment'
);
$attachments = get_children( $args );
foreach($attachments as $attachment){
//usa $attachment->ID per recuperare le informazioni dell'allegato
$image = wp_get_attachment_image_src($attachment->ID, 'large');
}

Grazie per il riferimento. Quindi come si inserisce nel loop? Cioè: come faccio a sapere quale id di miniatura corrisponde alla versione grande, media e piccola di quale immagine?

Grazie per l'aggiornamento sul riferimento a get_attachment_image_src! È perfetto per l'immagine in evidenza, ma come lo faccio per il loop delle immagini miniature nella galleria? Scusa se non capisco il concetto più facilmente - sto cercando di afferrarlo.

Vedi il mio tentativo in fondo alla mia domanda... più difficile di quanto pensassi inizialmente..

Ok ho capito leggendo bene il tuo suggerimento :) Il codice è nella mia domanda - magari puoi suggerire come ottimizzarlo meglio? Sto avendo difficoltà ora con le immagini della galleria..
