Last active
July 4, 2017 09:08
-
-
Save xlplugins/513036d59cfe9282b519a76bbaa4d7a1 to your computer and use it in GitHub Desktop.
Change WooCommerce single product positions in UNCODE theme for XL WooCommerce Sales Trigger Plugin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment