Last active
September 13, 2017 07:08
-
-
Save xlplugins/65b5785e1b2a6f25bcebd61dd755a059 to your computer and use it in GitHub Desktop.
Change Positions of Timers and Triggers against WC Native positions
This file contains hidden or 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
<?php | |
/** | |
* Change positions against woocommerce native positions. | |
* Code to be placed inside child theme's functions.php file | |
*/ | |
add_action('woocommerce_before_template_part', 'wcst_theme_helper_float_before_template_part', 99); | |
function wcst_theme_helper_float_before_template_part($template_name = '', $template_path = '', $located = '', $args = array()) { | |
if(!class_exists('WCST_Core')) { | |
return; | |
} | |
$wcst_core = WCST_Core::get_instance(); | |
if (empty($template_name)) { | |
return ''; | |
} | |
if ($template_name == 'single-product/title.php') { | |
echo $wcst_core->wcst_position_above_title(); | |
} elseif ($template_name == 'single-product/tabs/tabs.php') { | |
echo $wcst_core->wcst_position_above_tab_area(); | |
} | |
} | |
add_action('woocommerce_after_template_part', 'wcst_theme_helper_float_after_template_part', 99); | |
function wcst_theme_helper_float_after_template_part($template_name = '', $template_path = '', $located = '', $args = array()) { | |
if(!class_exists('WCST_Core')) { | |
return; | |
} | |
$wcst_core = WCST_Core::get_instance(); | |
if (empty($template_name)) { | |
return ''; | |
} | |
if ($template_name == 'single-product/title.php') { | |
echo $wcst_core->wcst_position_below_title(); | |
} elseif ($template_name == 'single-product/short-description.php') { | |
echo $wcst_core->wcst_position_below_short_desc(); | |
} elseif ($template_name == 'single-product/rating.php') { | |
echo $wcst_core->wcst_position_below_review(); | |
} elseif ($template_name == 'single-product/price.php') { | |
echo $wcst_core->wcst_position_below_price(); | |
} elseif ($template_name == 'single-product/meta.php') { | |
echo $wcst_core->wcst_position_below_meta(); | |
} elseif ($template_name == 'single-product/related.php') { | |
echo $wcst_core->wcst_position_below_related_products(); | |
} | |
} | |
/*************************************************************************/ | |
add_action('woocommerce_before_template_part', 'wcct_theme_helper_float_before_template_part', 99); | |
function wcct_theme_helper_float_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(); | |
} elseif ($template_name == 'single-product/tabs/tabs.php') { | |
echo $wcct_appearance->wcct_position_above_tab_area(); | |
} | |
} | |
add_action('woocommerce_after_template_part', 'wcct_theme_helper_float_after_template_part', 99); | |
function wcct_theme_helper_float_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(); | |
} elseif ($template_name == 'single-product/meta.php') { | |
echo $wcct_appearance->wcct_position_below_meta(); | |
} elseif ($template_name == 'single-product/related.php') { | |
echo $wcct_appearance->wcct_position_below_related_products(); | |
} | |
} | |
/** | |
* Handling for below add to cart position Starts here | |
*/ | |
add_action('woocommerce_after_add_to_cart_form', 'wcst_theme_after_add_to_cart_template'); | |
function wcst_theme_after_add_to_cart_template() { | |
if(!class_exists('WCST_Core')) { | |
return; | |
} | |
$wcst_core = WCST_Core::get_instance(); | |
$output = ""; | |
ob_start(); | |
echo $wcst_core->wcst_position_below_add_cart(); | |
$output = ob_get_clean(); | |
if($output !== "") { | |
echo '<div class="wcst_clear" style="height: 15px;"></div>'; | |
} | |
echo $output; | |
} | |
add_action('woocommerce_after_add_to_cart_form', 'wcct_theme_after_add_to_cart_template'); | |
function wcct_theme_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; | |
} | |
/** | |
* Handling for below add to cart position Ends Here | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment