Notice: These forums are now retired and closed. For active support, please Submit a Ticket or visit our official WordPress.org community pages.
Kadence Theme | Kadence Blocks | Starter Templates | WooCommerce Email Designer | Ascend | Virtue | Pinnacle

Getting to grips with hooks at last…

Home / Forums / Virtue Theme / Getting to grips with hooks at last…

This topic is: Resolved
[Resolved]
Posted in: Virtue Theme

Tagged: 

February 25, 2018 at 11:13 am

Hi Ben et al

After your hard work and exhortations I decided to make my changes to archive-product.php by using your hooks in my function file rather than over-riding the file in my child theme. But my first attempt has failed.

This is what I tried:

//Adapt main outer wappers in Woo under Virtue.
remove_action( ‘woocommerce_before_main_content’, ‘kt_woo_main_wrap_content_open’, 10);
add_action( ‘woocommerce_before_main_content’, ‘cp_woo_main_wrap_content_open’, 10);
function cp_woo_main_wrap_content_open() {
echo ‘<div id=”content” class=”container”><div class=”row customclass”><div class=”main ‘.kadence_main_class().'” role=”main”>’;
}

In another thread you gave this snippet for a similar tweak:

function kt_custom_child_init() {
remove_action( ‘woocommerce_above_main_content’, ‘kt_woocommerce_page_title_container’, 20 );
add_action( ‘woocommerce_before_main_content’, ‘kt_woocommerce_page_title_container_check’, 20 );
function kt_woocommerce_page_title_container_check() {
if(is_archive()) {
kt_woocommerce_page_title_container();
}
}
}
add_action(‘init’, ‘kt_custom_child_init’);

Can you explain to an idiot like me why what I am doing fails when it works in your templates and what the ‘init’ thing is doing and when to use it. And, if you can, give me a general approach so I don’t need to bug you!

  • The forum ‘Virtue Theme’ is closed to new topics and replies.