php WooCommerce旧单一产品定位钩 - 结局(由XLplugins)

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php WooCommerce旧单一产品定位钩 - 结局(由XLplugins)相关的知识,希望对你有一定的参考价值。

<?php
/**
 * Add following snippet in active theme (child if available) functions.php
 * This modifies the WooCommerce Single Product positions gven by Finale WooCommerce Countdown Timer plugin.
 * https://xlplugins.com/finale-woocommerce-sales-countdown-timer-discount-plugin/
 */

/** unhook all existing Finale Positions */
add_action( 'wp', 'wcct_themename_helper_wp', 99 );
if ( ! function_exists( 'wcct_themename_helper_wp' ) ) {

  	function wcct_themename_helper_wp() {
	  	if ( ! function_exists( 'WCCT_Core' ) ) {
			return;
		}
		$wcct_core = WCCT_Core()->appearance;

		// removing wcct action hooks on theme
		remove_action( 'woocommerce_single_product_summary', array( $wcct_core, 'wcct_position_above_title' ), 2.3 );
		remove_action( 'woocommerce_single_product_summary', array( $wcct_core, 'wcct_position_below_title' ), 9.3 );
		remove_action( 'woocommerce_single_product_summary', array( $wcct_core, 'wcct_position_below_review' ), 11.3 );
		remove_action( 'woocommerce_single_product_summary', array( $wcct_core, 'wcct_position_below_price' ), 17.3 );
		remove_action( 'woocommerce_single_product_summary', array( $wcct_core, 'wcct_position_below_short_desc' ), 21.3 );
		remove_action( 'woocommerce_single_product_summary', array( $wcct_core, 'wcct_position_below_add_cart' ), 39.3 );
	}
}

/** Hooking 'above title' position */
add_action( 'woocommerce_before_template_part', 'wcct_themename_helper_before_template_part', 99 );
if ( ! function_exists( 'wcct_themename_helper_before_template_part' ) ) {
	
	function wcct_themename_helper_before_template_part( $template_name = '', $template_path = '', $located = '', $args = array() ) {
		if ( ! function_exists( 'WCCT_Core' ) ) {
			return;
		}
		$wcct_appearance = WCCT_Core()->appearance;
		if ( empty( $template_name ) ) {
			return '';
		}
		if ( $template_name == 'single-product/title.php' ) {
			echo $wcct_appearance->wcct_position_above_title();
		}
	}
}

/** Hooking 'below title, price, review & short description' position */
add_action( 'woocommerce_after_template_part', 'wcct_themename_helper_after_template_part', 99 );
if ( ! function_exists( 'wcct_themename_helper_after_template_part' ) ) {
	
	function wcct_themename_helper_after_template_part( $template_name = '', $template_path = '', $located = '', $args = array() ) {
		if ( ! function_exists( 'WCCT_Core' ) ) {
			return;
		}
		$wcct_appearance = WCCT_Core()->appearance;
		if ( empty( $template_name ) ) {
			return '';
		}
		if ( $template_name == 'single-product/title.php' ) {
			echo $wcct_appearance->wcct_position_below_title();
		} elseif ( $template_name == 'single-product/short-description.php' ) {
			echo $wcct_appearance->wcct_position_below_short_desc();
		} elseif ( $template_name == 'single-product/rating.php' ) {
			echo $wcct_appearance->wcct_position_below_review();
		} elseif ( $template_name == 'single-product/price.php' ) {
			echo $wcct_appearance->wcct_position_below_price();
		}
	}
}

/** Hooking 'below add to cart' position */
add_action( 'woocommerce_after_add_to_cart_form', 'wcct_themename_after_add_to_cart_template', 99 );
if ( ! function_exists( 'wcct_themename_after_add_to_cart_template' ) ) {
	
	function wcct_themename_after_add_to_cart_template() {
		if ( ! function_exists( 'WCCT_Core' ) ) {
			return;
		}
		$wcct_appearance = WCCT_Core()->appearance;
		$output          = "";
		ob_start();
		echo $wcct_appearance->wcct_position_below_add_cart();
		$output = ob_get_clean();
		if ( $output !== "" ) {
			echo '<div class="wcct_clear" style="height: 15px;"></div>';
		}
		echo $output;
	}
}

以上是关于php WooCommerce旧单一产品定位钩 - 结局(由XLplugins)的主要内容,如果未能解决你的问题,请参考以下文章

php 为Betheme改变WooCommerce单一产品页面位置,用于XL WooCommerce销售触发插件

php 添加类以查看产品单上的提交按钮。这可以通过woocommerce模板覆盖单一产品/单一产品评论。

php 添加类以查看产品单上的提交按钮。这可以通过woocommerce模板覆盖单一产品/单一产品评论。

php 为XL WooCommerce销售触发插件更改Eva主题的WooCommerce单一产品页面位置

php 在XL WooCommerce销售触发插件的UNCODE主题中更改WooCommerce单一产品位置

php 在XL WooCommerce销售触发插件的Float主题中更改WooCommerce单一产品位置