2017-12-22 11 views
1

私は子供のテーマでウェブサイトを継承しました。この子テーマには、親のテーマをオーバーライドするWoocommerceフォルダーがあります。私は現在廃止されたテンプレートについて多くの警告を受けています。私はテンプレートを並べて比較する前にこのプロセスを行ってきましたが、今回はテンプレートが極端に異なっていることがわかりました。たとえば、これは最新のwoocommerce、「コンテンツ・シングルproduct.php」です:Woocommerceテンプレートの更新

if (! defined('ABSPATH')) { 
    exit; // Exit if accessed directly 
} 

?> 

<?php 
    /** 
    * woocommerce_before_single_product hook. 
    * 
    * @hooked wc_print_notices - 10 
    */ 
    do_action('woocommerce_before_single_product'); 

    if (post_password_required()) { 
     echo get_the_password_form(); 
     return; 
    } 
?> 

<div id="product-<?php the_ID(); ?>" <?php post_class(); ?>> 

    <?php 
     /** 
     * woocommerce_before_single_product_summary hook. 
     * 
     * @hooked woocommerce_show_product_sale_flash - 10 
     * @hooked woocommerce_show_product_images - 20 
     */ 
     do_action('woocommerce_before_single_product_summary'); 
    ?> 

    <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 
      * @hooked WC_Structured_Data::generate_product_data() - 60 
      */ 
      do_action('woocommerce_single_product_summary'); 
     ?> 

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

    <?php 
     /** 
     * woocommerce_after_single_product_summary hook. 
     * 
     * @hooked woocommerce_output_product_data_tabs - 10 
     * @hooked woocommerce_upsell_display - 15 
     * @hooked woocommerce_output_related_products - 20 
     */ 
     do_action('woocommerce_after_single_product_summary'); 
    ?> 

</div><!-- #product-<?php the_ID(); ?> --> 

<?php do_action('woocommerce_after_single_product'); ?> 

そして、これは私がこのテーマに持っているものです。もちろん

<?php 
/** 
* The template for displaying product content in the single-product.php template 
* 
* Override this template by copying it to yourtheme/woocommerce/content-single-product.php 
* 
* @author  WooThemes 
* @package  WooCommerce/Templates 
* @version  1.6.4 
*/ 

if (! defined('ABSPATH')) exit; // Exit if accessed directly 

$l = et_page_config(); 

$layout = etheme_get_option('single_layout'); 

$image_class = 'col-lg-6 col-md-6 col-sm-12'; 
$infor_class = 'col-lg-6 col-md-6 col-sm-12'; 

if($layout == 'small') { 
    $image_class = 'col-lg-4 col-md-5 col-sm-12'; 
    $infor_class = 'col-lg-8 col-md-7 col-sm-12'; 
} 

if($layout == 'large') { 
    $image_class = 'col-sm-12'; 
    $infor_class = 'col-lg-6 col-md-6 col-sm-12'; 
} 


if($layout == 'fixed') { 
    $image_class = 'col-sm-6'; 
    $infor_class = 'col-lg-3 col-md-3 col-sm-12'; 
} 

?> 

<?php 

    $class = 'tabs-'.etheme_get_option('tabs_location'); 
    $class .= ' single-product-'.$layout; 
    $class .= ' reviews-position-'.etheme_get_option('reviews_position'); 
    if(etheme_get_option('ajax_addtocart')) $class .= ' ajax-cart-enable'; 

    /** 
    * woocommerce_before_single_product hook 
    * 
    * @hooked wc_print_notices - 10 
    */ 
    do_action('woocommerce_before_single_product'); 

    if (post_password_required()) { 
     echo get_the_password_form(); 
     return; 
    } 

    if(!etheme_get_option('product_name_signle')) { 
     $class .= ' hide-product-name'; 
    } 
?> 

<div itemscope itemtype="<?php echo woocommerce_get_product_schema(); ?>" id="product-<?php the_ID(); ?>" <?php post_class($class); ?>> 

    <div class="row"> 
     <div class="<?php esc_attr_e($l['content-class']); ?> product-content sidebar-position-<?php esc_attr_e($l['sidebar']); ?>"> 
      <div class="row"> 
       <?php if ($layout == 'fixed'): ?> 
        <div class="col-md-3 product-summary-fixed"> 
         <div class="fixed-product-block"> 
          <div class="fixed-content"> 
           <?php 
            woocommerce_template_single_title(); 
            woocommerce_template_single_rating(); 
            echo '<hr class="divider short">'; 
            woocommerce_template_single_excerpt(); 
            echo do_shortcode('[share title="'.__('Share Social', ET_DOMAIN).'" text="'.get_the_title().'"]'); 
           ?> 
          </div> 
         </div> 
        </div> 
       <?php endif ?> 
       <div class="<?php esc_attr_e($image_class); ?> product-images"> 
        <?php 
         /** 
         * woocommerce_before_single_product_summary hook 
         * 
         * @hooked woocommerce_show_product_sale_flash - 10 
         * @hooked woocommerce_show_product_images - 20 
         */ 
         do_action('woocommerce_before_single_product_summary'); 
        ?> 
       </div><!-- Product images/ END --> 

       <?php 
        if($layout == 'large') { 
         ?> 
         </div> 
         <div class="row"> 
         <?php 
        } 
       ?> 

       <div class="<?php esc_attr_e($infor_class); ?> product-information"> 
        <div class="product-information-inner <?php if($layout == 'fixed') echo 'fixed-product-block' ?>"> 
         <div class="fixed-content"> 
          <?php if(!etheme_get_option('product_name_signle')): ?> 
           <h4 class="title"><?php _e('Product Information', ET_DOMAIN); ?></h4> 
          <?php endif; ?> 

          <?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'); 
          ?> 

          <?php if(etheme_get_option('share_icons') && $layout != 'fixed') echo do_shortcode('[share title="'.__('Share Social', ET_DOMAIN).'" text="'.get_the_title().'"]'); ?> 
         </div> 
        </div> 
       </div><!-- Product information/ END --> 
       <?php 
        if($layout == 'large') { 
         ?> 
          <div class="<?php esc_attr_e($infor_class); ?>"> 
           <?php do_action('woocommerce_after_single_product_summary'); ?> 
          </div> 
         <?php 
        } 
       ?> 
      </div> 

      <?php 
       /** 
       * woocommerce_after_single_product_summary hook 
       * 
       * @hooked woocommerce_output_product_data_tabs - 10 
       * @hooked woocommerce_output_related_products - 20 [REMOVED in woo.php] 
       */ 
       if(etheme_get_option('tabs_location') == 'after_content' && $layout != 'large') { 
        do_action('woocommerce_after_single_product_summary'); 
       } 
      ?> 

     </div> <!-- CONTENT/ END --> 


     <?php if($l['sidebar'] != '' && $l['sidebar'] != 'without' && $l['sidebar'] != 'no_sidebar'): ?> 
      <div class="<?php esc_attr_e($l['sidebar-class']); ?> single-product-sidebar sidebar-<?php esc_attr_e($l['sidebar']); ?>"> 
       <?php et_product_brand_image(); ?> 
       <?php if(etheme_get_option('upsell_location') == 'sidebar') woocommerce_upsell_display(); ?> 
       <?php dynamic_sidebar('single-sidebar'); ?> 
      </div> 
     <?php endif; ?> 
    </div> 

    <?php if(etheme_get_option('upsell_location') == 'after_content') woocommerce_upsell_display(); ?> 
    <?php 
     if(etheme_get_custom_field('additional_block') != '') { 
      echo '<div class="product-extra-content">'; 
       et_show_block(etheme_get_custom_field('additional_block')); 
      echo '</div>'; 
     }  
    ?> 
    <?php if(etheme_get_option('show_related')) woocommerce_output_related_products(); ?> 


    <meta itemprop="url" content="<?php the_permalink(); ?>" /> 

</div><!-- #product-<?php the_ID(); ?> --> 

<?php do_action('woocommerce_after_single_product'); ?> 

最新Woocommerceが行う使用します私はこのような場合にどのように進めるべきですか?

答えて

0

古いファイルは、あなたの子テーマのwoocommerceフォルダにあります。あなたがテーマを購入した場合は、サポートに連絡して、テーマが互換性のために更新されているため、

テンプレートに重要なカスタマイズがあった場合は、古いテンプレートと新しいテンプレート(プラグインのWooCommerceのテンプレートフォルダにあります)とを比較するという面白い仕事が始まります。テーマフォルダに貼り付けたテンプレートをメモ帳++などのテキストエディタを選択し、以前のテンプレートに加えた変更を新しい更新テンプレートファイルに複製します。

回答が見つかったhttps://wordpress.stackexchange.com/questions/152930/how-do-i-update-woocommerce-template-files-in-my-theme

関連する問題