我有以下代码:
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>
问题#1:其中说明:
<?php echo get_the_post_thumbnail( $post->ID, \'product-400x600\' ); ?>
我需要它告诉我
<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>`
在回显图像的地方(大且产品为400x600),我需要它只回显img url,而不需要它附带的所有其他html。如何修复我的上述代码,使其以我所需的方式呈现?
问题#2:其中说明:
echo \'<a href="\'.$gallery_image.\'" title="\'.$gallery_image_alt.\'" class="fancybox" rel="single-gallery"><img src="\' . $gallery_thumb . \'" /></a>\';
这是该图库中所有其他图像的循环。对于循环中的每个图像<我需要它告诉我
<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>
同样,与#1的问题相同,我需要它只回显图像url/src。
其工作方式如下例所示:http://www.magictoolbox.com/magiczoomplus/
提前感谢您!
Edit
根据布莱恩的建议,我第一次尝试以下特色图片,效果很好!
<?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>\'; ?>
Now the question is, how do I go about this for the image gallery items?