2016-02-07 50 views
1

我需要重新设计产品页面的默认woocommerce模板。 我试图将avada的结构复制到儿童主题。如何使用Avada儿童主题覆盖Woocommerce单一产品模板页面

/theme/avada/woocommerce/single-product/*/theme/avada-child-theme/woocommerce/single-product/

但我找不到显示整个页面的模板。只有title.php确实会改变标题。但找不到页面的其余部分。 我需要删除这些部分:

- short description 
- sku 
- social media buttons 

我如何重新设计一个完整的产品页面是新的我。 可能有人可以给我一个开始在哪里可以找到模板。

在此先感谢。 赫尔曼

<?php 
/** 
* The template for displaying product content in the single-product.php template 
* 
* This template can be overridden by copying it to yourtheme/woocommerce/content-single-product.php. 
* 
* HOWEVER, on occasion WooCommerce will need to update template files and you (the theme developer). 
* will need to copy the new files to your theme to maintain compatibility. We try to do this. 
* as little as possible, but it does happen. When this occurs the version of the template file will. 
* be bumped and the readme will list any important changes. 
* 
* @see   http://docs.woothemes.com/document/template-structure/ 
* @author  WooThemes 
* @package  WooCommerce/Templates 
* @version  1.6.4 
*/ 

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 itemscope itemtype="<?php echo woocommerce_get_product_schema(); ?>" 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 
      */ 
     remove_action('woocommerce_single_product_summary', 'woocommerce_template_single_excerpt', 20); 
      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'); 
    ?> 

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

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

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

回答

2

我不知道的阿瓦达索theem,但在默认WooCommerce你可以在简短说明和社交按钮通过加入content-single-product.php模板见。所以要删除它们,您需要使用主题functions.php中的remove_action()

如果这样做不起作用,请查看remove_action(),因为您只需确保参数与Avada主题的功能相匹配即可。

function so_35252579_remove_hooks(){ 
    remove_action('woocommerce_single_product_summary', 'woocommerce_template_single_excerpt', 20); 
    remove_action('woocommerce_single_product_summary', 'woocommerce_template_single_sharing', 50); 
} 
add_action('woocommerce_before_single_product', 'so_35252579_remove_hooks'); 

要删除SKU,你既可以禁用的SKU,或者如果你需要他们,但不想在前端显示它们,那么你就需要重写single-product/meta.php

+0

Helgo,这是一个解决方案的一部分。谢谢。如何重新安排潜水员挂钩仍然是开放的。我没有看到任何类型的PHP文件中的CSS。 – Hermants

+0

不会有任何CSS的PHP文件。重新排列钩子是通过从一个钩子(如上图)去除函数并使用['add_action()'](https://developer.wordpress.org/reference/functions/add_action/)将它们添加到另一个钩子来完成的。如果您要编辑您的问题以粘贴Avada主题的'content-single-product.php'模板,我可以确认我的代码是否可以删除摘录和共享。 – helgatheviking

+0

Helga。我有个问题需要理解你的意思:“如果你要编辑你的问题来粘贴Avada主题的content-single-product.php模板,”希望你能解释一下。 – Hermants

相关问题