I'm trying to add :
require get_template_directory() . '/mytheme/folder/file.php';
To specific category in WooCommerce, I tried already:
function get_file() {
if( has_term( 'categoryName', 'product_cat' ) ) {
require get_template_directory() . '/mytheme/folder/file.php';
}
}
add_action( 'woocommerce_before_main_content', 'get_file');
But it doesen't work ;/
How can i add this file only for 1 category?
Or for multi cat. by using else if
Regards, Gabrielle
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…