<form role="search" method="get" class="woocommerce-product-search" name="s"
action="<?php echo esc_url(home_url('/')); ?>">
<input style="display: none;" type="search"
id="woocommerce-product-search-field-<?php echo isset($index) ? absint($index) : 0; ?>"
class="search-field"
placeholder="<?php echo esc_attr__('Search products…', 'woocommerce'); ?>" value=""
name="s"/>
<div class="search_title">
Фильтр по параметрам шин
</div>
<div class="row s-fast-search__row justify-content-center">
<div class="col-md-12">
<?php
$diametr = wp_dropdown_categories("taxonomy=pa_diametr&echo=0&show_option_none=Все внутренние диаметры шин&name=diametr");
?>
<label>Выберите внутренний диаметр шины</label>
<div><?php echo $diametr; ?></div>
</div>
<div class="col-md-12">
<?php
$razmer = wp_dropdown_categories("taxonomy=pa_razmer&echo=0&show_option_none=Все размеры&name=razmer");
?>
<label>Выберите размер</label>
<div> <?php echo $razmer; ?></div>
</div>
<div class="col-md-12">
<?php $dropdowncats = wp_dropdown_categories(
'hide_empty=0&depth=1&orderby=name&order=ASC&selected='.$_GET['product_cat'].'&hierarchical=1&echo=0&taxonomy=product_cat&show_option_none=Все категории'
); ?>
<label>Категории</label>
<div><?php echo $dropdowncats; ?></div>
</div>
</div>
<!--row-->
<button type="submit" class="filtr_search_button"
value="<?php echo esc_attr_x('Search', 'submit button', 'woocommerce'); ?>">Искать
</button>
<input type="hidden" name="post_type" value="product"/>
</form>
//Для формы фильтра на главную страницу
add_action('pre_get_posts', 'search_by_cat');
function search_by_cat() {
global $wp_query;
if (is_search()) {
$diametr = intval($_GET['diametr']);
if($diametr>0){
$wp_query->query_vars['tax_query'][] = array( //для атрибутов товаров
"taxonomy" => "pa_diametr",
"field" => "id",
"terms" => $diametr
);
}
$razmer = intval($_GET['razmer']);
if($razmer>0){
$wp_query->query_vars['tax_query'][] = array(
"taxonomy" => "pa_razmer",
"field" => "id",
"terms" => $razmer
);
}
$cat = intval($_GET['cat']);
if($cat<0){
$wp_query->query_vars['product_cat'] = '';
}else{
$term = get_term_by('id',$cat,'product_cat');
$wp_query->query_vars['cat'] = '';
$wp_query->query_vars['product_cat'] = $term->slug;
}
}
}
//Для формы фильтра на главную страницу - конец
**
* Remove the generated product schema markup from Product Category and Shop pages.
*/
function wc_remove_product_schema_product_archive() {
remove_action( 'woocommerce_shop_loop', array( WC()->structured_data, 'generate_product_data' ), 10, 0 );
}
add_action( 'woocommerce_init', 'wc_remove_product_schema_product_archive' );
remove_action( 'woocommerce_archive_description', 'woocommerce_taxonomy_archive_description', 10 );
add_action( 'woocommerce_after_shop_loop', 'woocommerce_taxonomy_archive_description', 100 );
add_action( 'woocommerce_single_product_summary', 'my_theme_my_action', 41 );
function my_theme_my_action() {
echo '<div class="">Код какой нужно вставить</div>';
}
<?php
$Path=$_SERVER['REQUEST_URI'];
$URI_RU='http://ru.test'.$Path;
$URI_ES='http://es.test'.$Path;
$URI_EN='http://test'.$Path;
?>
<a href="<?php echo $URI_ES ?>">ES</a>
<a href="<?php echo $URI_RU ?>">RU</a>
<a href="<?php echo $URI_EN ?>">EN</a>
function my_template_loop_product_title(){
global $product;
echo '<h3 itemprop="name" class="product_title entry-title">';
$versionvalues = get_the_terms( $product->id, 'pa_model');
foreach ( $versionvalues as $versionvalue ) {
echo $versionvalue->name;
}
echo '</h3>';
}
add_action( 'woocommerce_shop_loop_item_title', 'my_template_loop_product_title', 10 );
add_action( 'woocommerce_single_product_summary', 'my_theme_my_action', 41 );
function my_theme_my_action() {
echo '<div class="">Код какой нужно вставить</div>';
}