This hook allows set logic ‘AND‘ for any taxonomies in the WOOF search request.
Use it in your current wp theme functions.php file:
add_filter('woof_main_query_tax_relations', 'my_woof_main_query_tax_relations');
function my_woof_main_query_tax_relations()
{
return array(
'product_cat' => 'AND'
);
}
In the example above shown how to apply logic ‘AND‘ for products categories. The same possible to realize for more taxonomies on the same time:
add_filter('woof_main_query_tax_relations', 'my_woof_main_query_tax_relations');
function my_woof_main_query_tax_relations()
{
return array(
'product_cat' => 'AND',
'product_tag' => 'AND',
'pa_color' => 'AND'
);
}
Video: https://drive.google.com/file/d/0B4zUhfhZlonlNkVXMEZIdUxlWFU/view?usp=sharing
[...]
Use hook woof_title_tag if you want to redefine title tag H4 for each taxonomies block to any another HTML tag.
Example:
add_filter('woof_title_tag', function($tag){
return 'h5';
});
[...]
How many posts should return autocomplete functionality for Text textinput
add_filter('woof_text_autocomplete_items', function($count){
return 5;
});
[...]
If you by any reason want to remade native woo price slider in the WOOF search form.
- classes/helper.php
- public static function price_filter
apply_filters('woof_price_slider_html', $price_slider_html, $price_slider_data);
[...]
Uses for any term with child’s terms when its necessary hide that child’s terms at all in: checkboxes, radio,select,mselect,labels.
add_filter('woof_terms_where_hidden_childs', function($term_id)
{
$hide_array=array(11,22,33,44,55,66,77);
if (in_array($term_id, $hide_array))
{
return true;
}
return false;
}, 1, 1);
[...]
Uses for ordering terms in the search form.
- classes/helper.php
- public static function get_terms
Used in pair with woof_get_terms_orderby
add_filter('woof_get_terms_order', function($taxonomy)
{
if ($taxonomy == 'pa_size')
{
return 'DESC';//ASC
}
}, 1, 1);
[...]
Uses for ordering terms in the search form.
- classes/helper.php
- public static function get_terms
Used in pair with woof_get_terms_order
add_filter('woof_get_terms_orderby', function($taxonomy)
{
if ($taxonomy == 'pa_size')
{
return 'term_id';
}
}, 1, 1);
[...]
Useful for taxonomies relations manipulation, for example changing relation from OR to AND. Doesn’t work with dynamic recount together.
- index.php
- private function get_tax_query
add_filter('woof_get_tax_query', 'my_woof_get_tax_query');
function my_woof_get_tax_query($tax_args){
//do smth here
return $tax_args;
}
[...]
Using in extensions to add additional options in tab Design if its necessary.
Example:
add_action('woof_print_design_additional_options', array($this, 'my_design_additional_options'), 10, 1);
public function my_design_additional_options()
{
global $WOOF;
$woof_settings = $WOOF->settings;
if (!isset($woof_settings))
{
$woof_settings = '';
}
?>
<div class="woof-control-section">
<h4><?php _e('Image for checked color type checkbox', 'woocommerce-products-filter') ?></h4>
<div class="woof-control-container">
<div class="woof-control woof-upload-style-wrap">
<input type="text" name="woof_settings" value="<?php //echo $woof_settings ?>" />
<a href="#" class="woof-button woo [...]
Using in extension for printing additional options under ‘additional options’ button like in color:
Example:
add_action('woof_print_tax_additional_options_color', array($this, 'print_additional_options'), 10, 1);
public function print_additional_options($key)
{
global $WOOF;
$woof_settings = $WOOF->settings;
$terms = WOOF_HELPER::get_terms($key, 0, 0, 0, 0);
if (!empty($terms))
{
echo '<ul class="woof_color_list">';
foreach ($terms as $t)
{
$col [...]