2012-10-03 55 views
3

我需要我的WordPress主题帮助。在我的文章中,我只使用附加的图像。所以我制作了一个产品滑块,可以自动将图像从附件添加到此产品滑块。 要显示的图像I使用:如何使用WP中的任何jQuery缩放插件缩放附加图像?

<?php echo wp_get_attachment_image($product_image->ID, array(350, 250)); ?> 

但这函数也创建在其上显示图像的一些DIV元素。所以我不能只是添加一个需要的图像,因为jQuery的缩放插件需要。有谁能够帮助我?我只想使用一些these zoom plugins

我没有很多声望,所以我无法在pastebin上发布链接。
这里是HTML + PHP

<div id="slides" class="grid_5"> 

<div class="slides_container grid_5"> 
    <?php 
    $product_images = get_posts(
      array(
       'posts_per_page' => -1, 
       'post_type' => 'attachment', 
       'post_mime_type' => 'image', 
       'post_parent' => $post->ID, 
       'order' => 'ASC' 
      ) 
     ); 

    foreach($product_images as $product_image) :?> 
     <div> 


      <center> 
      <?php echo wp_get_attachment_image($product_image->ID, array(350, 250)); ?> 
      </center> 
     </div> 
    <?php 
    endforeach; 
    ?> 
</div> 
<br> 
    <ul class="pagination grid_5">  
     <?php 
     reset($product_images); 
     foreach($product_images as $product_image) :?> 
      <li><a href="#"><?php echo wp_get_attachment_image($product_image->ID, array(50, 50)); ?></a></li> 
     <?php 
     endforeach; 
     ?> 
    </ul> 

而生成的HTML:http://pastebin.com/EZByPvYm

+0

你发送的链接有很多。你正在使用哪个特定的缩放插件?你也可以给我们生成HTML代码吗? –

回答

0

wp_get_attachment_image()具有两个更多的参数,第四参数是用于覆盖HTML标签,其wp_get_attachment_image()产生,使用下面码的属性。

<?php echo wp_get_attachment_image($product_image->ID, array(350, 250), false, array('class' => 'YOUR-DESIRED-CLASSNAME')); ?>