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

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php 在XL WooCommerce销售触发插件的UNCODE主题中更改WooCommerce单一产品位置相关的知识,希望对你有一定的参考价值。

/**
 * Add This whole code in working theme functions.php inside php tag to alter woocommerce native positions
 * Theme: https://themeforest.net/item/uncode-creative-multiuse-wordpress-theme/13373220
 * XL WooCommerce Sales Trigger Class Instance
 */
add_action('wp', 'uncode_wcst_modify_positions', 99);
if (!function_exists('uncode_wcst_modify_positions')) {

    function uncode_wcst_modify_positions() {
        if (class_exists('WCST_Core')) {
                $wcst_core = WCST_Core::get_instance();

                // removing below price and below add to cart buttton action hook of plugin
                remove_action('woocommerce_after_single_product_summary', array($wcst_core, 'wcst_position_above_tab_area'), 9.8);
                remove_action('woocommerce_after_single_product_summary', array($wcst_core, 'wcst_position_below_related_products'), 21.2);

                // hooking below functions for 'uncode' theme
                add_action('uncode_theme_above_tab_area', function () {
                    echo '<div class="row row-parent limit-width">';
                }, 9);
                add_action('uncode_theme_above_tab_area', array($wcst_core, 'wcst_position_above_tab_area'), 10);
                add_action('uncode_theme_above_tab_area', function () {
                    echo '</div>';
                }, 11);
                add_action('uncode_theme_below_related_products', array($wcst_core, 'wcst_position_below_related_products'), 10);
        }
    }

}

add_action('woocommerce_single_product_summary', function() {
    echo '<div style="clear:both;"></div>';
}, 10);

add_action('woocommerce_before_template_part', 'wcst_theme_helper_uncode_before_template_part', 99);

function wcst_theme_helper_uncode_before_template_part($template_name = '', $template_path = '', $located = '', $args = array()) {
    if (empty($template_name)) {
        return '';
    }
    if ($template_name == 'single-product/tabs/tabs.php') {
        do_action('uncode_theme_above_tab_area');
    }
}

add_action('woocommerce_after_template_part', 'wcst_theme_helper_uncode_after_template_part', 99);

function wcst_theme_helper_uncode_after_template_part($template_name = '', $template_path = '', $located = '', $args = array()) {
    if (empty($template_name)) {
        return '';
    }
    if ($template_name == 'single-product/related.php') {
        do_action('uncode_theme_below_related_products');
    }
}

以上是关于php 在XL WooCommerce销售触发插件的UNCODE主题中更改WooCommerce单一产品位置的主要内容,如果未能解决你的问题,请参考以下文章

php 更改WooCommerce单个产品在WOWMALL主题中的位置,用于XL WooCommerce销售触发插件

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

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

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

php 在Shopkeeper主题中为XL WooCommerce Sales Trigger插件更改WooCommerce单一产品位置

php WooCommerce旧单产品定位钩 - 用于销售触发(由XLplugins提供)