woocommerce
一、woocommerce获取产品基本信息
1、关于钩子定义
位置:根目录/wp-content/plugins/woocommerce/include/wc-template-hooks.php第144行开始
add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_title', 5 );add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_rating', 10 );add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 10 );add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_excerpt', 20 );add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_meta', 40 );add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_sharing', 50 );
2、相关联的函数:
代码位置:根目录/wp-content/plugins/woocommerce/include/wc-template-functions.php第825行开始
if ( ! function_exists( 'woocommerce_template_single_title' ) ) {/*** Output the product title.** @subpackage Product*/function woocommerce_template_single_title() {wc_get_template( 'single-product/title.php' );}}if ( ! function_exists( 'woocommerce_template_single_rating' ) ) {/*** Output the product rating.** @subpackage Product*/function woocommerce_template_single_rating() {wc_get_template( 'single-product/rating.php' );}}if ( ! function_exists( 'woocommerce_template_single_price' ) ) {/*** Output the product price.** @subpackage Product*/function woocommerce_template_single_price() {wc_get_template( 'single-product/price.php' );}}if ( ! function_exists( 'woocommerce_template_single_excerpt' ) ) {/*** Output the product short description (excerpt).** @subpackage Product*/function woocommerce_template_single_excerpt() {wc_get_template( 'single-product/short-description.php' );}}if ( ! function_exists( 'woocommerce_template_single_meta' ) ) {/*** Output the product meta.** @subpackage Product*/function woocommerce_template_single_meta() {wc_get_template( 'single-product/meta.php' );}}if ( ! function_exists( 'woocommerce_template_single_sharing' ) ) {/*** Output the product sharing.** @subpackage Product*/function woocommerce_template_single_sharing() {wc_get_template( 'single-product/share.php' );}}
3、相关模板输出:根据以上函数,很容易可以推断出模板的位置:
文件位置:根目录/wp-content/themes/当前模板/woocommerce/single-product/目录下可找到相应的模板
二、woocommerce修改购物车的样式(没有page页面的情况下)
主体内容的修改要在content.php里面修改
