Building an ecommerce site with WooCommerce. I am trying to modify the theme layout by removing functions from the default hook, and plugging them into another one (so they appear on a different part of the page.
I've successfully removed one function and plugged it into another hook...
remove_action('woocommerce_single_product_summary', 'woocommerce_template_single_meta', 40);
add_action('woocommerce_below_single_product_display', 'woocommerce_template_single_meta', 40);
That worked find, except what I don't understand is that I have to use the priority tag 40, any higher it won't work, and less it won't work? I thought the remove action priority just had to be a higher number so that it is called after the action is created.
Now one element on the page I couldn't figure out how it was getting inserted onto the theme, using another gentlemen's function that lists all hooks and functions I was able to isolate it...
function list_hooked_functions($tag='woocommerce_single_product_summary'){
global $wp_filter;
if ($tag) {
$hook[$tag]=$wp_filter[$tag];
if (!is_array($hook[$tag])) {
trigger_error("Nothing found for '$tag' hook", E_USER_WARNING);
return;
}
}
else {
$hook=$wp_filter;
ksort($hook);
}
echo '<pre>';
foreach($hook as $tag => $priority){
echo "<br />>>>>>\t<strong>$tag</strong><br />";
ksort($priority);
foreach($priority as $priority => $function){
echo $priority;
foreach($function as $name => $properties) echo "\t$name<br />";
}
}
echo '</pre>';
return;
}
What this function returned was...
I isolated the function that needed to be removed from the hook. So I have this in my functions.php
add_action('init', function(){
remove_action('woocommerce_single_product_summary', 'woocommerce_template_single_meta', 40);
remove_action('woocommerce_single_product_summary', 'venedor_single_product_links', 3135);
add_action('woocommerce_below_single_product_display', 'woocommerce_template_single_meta', 40);
add_action('woocommerce_below_single_product_display', 'venedor_single_product_links', 40);
}, 9000);
I just can't get it to remove that venedor_single_product_links fucntions. I've tried raising the priority number, lowering it, not having it. Using the 'wp_head' action instead.
Can anyone suggest why this may not be working and anything else I can try...
Thanks for your time.