![Ожидается изображения товара](https://volzhskij.tantal-metall.com/wp-content/uploads/woocommerce-placeholder-600x600.png)
![Ожидается изображения товара](https://volzhskij.tantal-metall.com/wp-content/uploads/woocommerce-placeholder-600x600.png)
add_filter( 'template_include', 'template_categories_product', 11); function template_categories_product( $template ) { if(!is_admin()) { if (is_shop() || is_tax('product_cat')) { $parent_id=0; if(is_tax('product_cat')) { $parent_id = get_queried_object_id(); } global $TERMS; $args = [ 'taxonomy' => [ 'product_cat' ], 'hide_empty' => false, 'parent' => $parent_id, ]; if(is_shop()) { $args['exclude']=15; } $TERMS=get_terms($args); if($TERMS) { if ($new_template = locate_template(array('woocommerce/categories_page.php'))) { $template = $new_template; } } } } return $template; } add_filter( 'template_include', 'template_uslugi_proizvodstvo', 11); function template_uslugi_proizvodstvo ($template) { if(!is_admin()) { if ((is_post_type_archive('proizvodstvo') || is_post_type_archive('uslugi'))) { if ($new_template = locate_template(array('archive-uslugi-proizvodstvo.php'))) { $template = $new_template; } } if ((is_singular('proizvodstvo') || is_singular('uslugi'))) { if ($new_template = locate_template(array('single-uslugi-proizvodstvo.php'))) { $template = $new_template; } } } return $template; } function ajax_cart_rule() { add_rewrite_rule( 'ajaxcart', 'index.php?ajaxcart=yes', 'top' ); add_filter( 'query_vars', function( $vars ){ $vars[] = 'ajaxcart'; return $vars; } ); } add_action( 'init', 'ajax_cart_rule' ); function prefix_ajax_cart_rewrite_templates() { if ( get_query_var( 'ajaxcart' )=='yes') { global $wp_query; $wp_query->is_home = false; add_filter( 'template_include', function() { return get_template_part( 'includes/parts/ajax_cart' ); }); } } add_action( 'template_redirect', 'prefix_ajax_cart_rewrite_templates' ); ?>