2016-07-01 135 views
0

在woocommerce,我們可以通過複製woocommerce模板文件夾入主題覆蓋模板 - 步在這裏給出:LINK如何編輯woocommerce產品頁面?

我想是改變woocommerce產品頁面的佈局。 我無法找到要編輯的模板php文件以更改產品頁面佈局。例如檢查該產品的頁面 - PRODUCT PAGE

我想要做的就是把從左邊的圖像右側。並將標題放在左側。像這樣的東西。

但我不能找到一個模板PHP文件來做到這一點。我該怎麼做才能做到這一點?

+0

如果你不介意編輯模板,但使用CSS。然後我會應用.images {float:right;}。這CSS會達到你想要的.. –

回答

1

你需要去woocommerce \ templates目錄,並修改爲內容的單product.php或單個產品的文件夾。 以其它方式使用此CSS

.images { 
float: right !important; 
    } 
0

以下是通過代碼的方式: 插件\ woocommerce \模板\單品\產品image.php

<div class="images"> 
    <?php 
     if (has_post_thumbnail()) { 
      $image_caption = get_post(get_post_thumbnail_id())->post_excerpt; 
      $image_link = wp_get_attachment_url(get_post_thumbnail_id()); 
      $image   = get_the_post_thumbnail($post->ID, apply_filters('single_product_large_thumbnail_size', 'shop_single'), array(
       'title' => get_the_title(get_post_thumbnail_id()) 
      )); 

      $attachment_count = count($product->get_gallery_attachment_ids()); 

      if ($attachment_count > 0) { 
       $gallery = '[product-gallery]'; 
      } else { 
       $gallery = ''; 
      } 

      echo apply_filters('woocommerce_single_product_image_html', sprintf('<a href="%s" itemprop="image" class="woocommerce-main-image zoom" title="%s" data-rel="prettyPhoto' . $gallery . '">%s</a>', $image_link, $image_caption, $image), $post->ID); 

     } else { 

      echo apply_filters('woocommerce_single_product_image_html', sprintf('<img src="%s" alt="%s" />', wc_placeholder_img_src(), __('Placeholder', 'woocommerce')), $post->ID); 

     } 
    ?> 

    <?php do_action('woocommerce_product_thumbnails'); ?> 
</div> 

插件\ woocommerce \模板\內容 - single-product.php

<div class="summary entry-summary"> 

     <?php 
      /** 
      * woocommerce_single_product_summary hook. 
      * 
      * @hooked woocommerce_template_single_title - 5 
      * @hooked woocommerce_template_single_rating - 10 
      * @hooked woocommerce_template_single_price - 10 
      * @hooked woocommerce_template_single_excerpt - 20 
      * @hooked woocommerce_template_single_add_to_cart - 30 
      * @hooked woocommerce_template_single_meta - 40 
      * @hooked woocommerce_template_single_sharing - 50 
      */ 
      do_action('woocommerce_single_product_summary'); 
     ?> 

    </div><!-- .summary --> 
+0

老兄,我可能想聘請你在未來的發展工作。我其實在尋找擅長woocommerce和wordpress的人來開展業務。你怎麼做btw? – Adam

+0

謝謝,我是專業的大型商業和WordPress WOO商務網站開發人員。如果您覺得這對您有幫助,請投我的答案。 –