$filter->set('tax_query', array(
array(
'taxonomy' => 'post_tag',
'field' => 'slug',
'terms' => $terms,
'operator' => 'NOT IN'
)
));
$filter->set('tax_query', array_merge( $filter->get('tax_query', array()), array(
array(
'taxonomy' => 'post_tag',
'field' => 'slug',
'terms' => $terms,
'operator' => 'NOT IN'
)
) ));
add_filter('pre_get_posts', function($filter) {
$file = 'filter1/level_1.txt';
if ($_SESSION['filter1'] == '') {
$file = 'filter1/level_1.txt';
} else if ($_SESSION['filter1'] == 1) {
$file = 'filter1/level_1.txt';
} else if ($_SESSION['filter1'] == 2) {
$file = 'filter1/level_2.txt';
}
return exc_post($filter, $file);
});
add_filter('pre_get_posts', function($filter) {
$file = 'filter2/level_1.txt';
if ($_SESSION['filter2'] == 1){
$file = 'filter2/level_1.txt';
} else if ($_SESSION['filter2'] == 2){
$file = 'filter2/level_1.txt';
} else if ($_SESSION['filter2'] == ''){
$file = 'filter2/level_2.txt';
}
return exc_post($filter, $file);
});
jQuery(document.body).on('change', '#pa_color', function (event) {
var selectElement = jQuery(event.currentTarget),
color = selectElement.val(),
formElement = selectElement.parents('.variations_form'),
productVariations = JSON.parse(formElement.attr('data-product_variations'));
for ( var index in productVariations ) {
var productVariation = productVariations[index];
if (productVariation.attributes.hasOwnProperty('attribute_pa_color') && productVariation.attributes.attribute_pa_color == color) {
var productElement = formElement.parents('.product:first');
productElement.find('.attachment-woocommerce_thumbnail').attr('src', productVariation.image.url);
break;
}
}
});
Создайте свой класс и наследуйте его от WP_Widget_Categories. А так же поменяйте id виджета и название.