2017-12-22 14 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'); ?> 

그리고 이것은 내가이 주제에있는 것입니다 :

최신 Woocommerce를 사용 물론
<?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'); ?> 

가 있습니다 상점은 그렇게 보이지 않습니다. 이렇게하면 어떻게해야합니까?

답변

0

오래된 파일은 하위 테마의 woocommerce 폴더에 있습니다. 테마를 구입 한 경우 해당 테마가 호환성을 위해 업데이트되었으므로 업그레이드 지원에 문의하십시오.

템플릿에 중요한 맞춤 설정이있는 경우 기존 템플릿을 새로운 템플릿 (플러그인 WooCommerce의 템플릿 폴더에 있음)과 비교하는 재미있는 작업을 시작합니다. 템플릿을 열고 테마 폴더에 붙여 넣은 템플릿을 엽니 다. 메모장 + +와 같은 텍스트 편집기를 선택하고 이전 템플릿에 대한 모든 변경 사항을 업데이트 된 새 템플릿 파일에 복제하십시오.

내가 대답을 찾은 분 https://wordpress.stackexchange.com/questions/152930/how-do-i-update-woocommerce-template-files-in-my-theme