2012-10-03 53 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')); ?>