Created by shortcodes: [taxonomy_chain_menu post_type=’product’ exclude=’89,105′ taxonomy=’product_cat’ target=’_blank’ label_taxonomy=’call_filter_chain1′ label_post=’call_filter_chain1-post’ button_title=’Take it!’ do_filter2=’woof’ watch_view=’post’ label_before=’Select your wear‘ select_wrapper=’selectron23′ chain_id=’chain1′ select_width=’300px’ selectron23_max_open_height=’300′]
See also the code below products.
Notes:
- target – this attribute is from premium version of the plugin
- label_taxonomy=’Type|Model’ – such syntax is from premium version of the plugin
- label_before – this attribute is from premium version of the plugin
- select_wrapper – this attribute is from premium version of the plugin
[taxonomy_chain_menu post_type=’product’ exclude=’89,105′ taxonomy=’product_cat’ target=’_blank’ label_taxonomy=’call_filter_chain1′ label_post=’call_filter_chain1-post’ button_title=’Take it!’ do_filter2=’woof’ watch_view=’post’ label_before=’Select your wear: ‘ select_wrapper2=’selectron23′ chain_id=’chain1′ select_width=’300px’ selectron23_max_open_height=’300′]
The same shortcode but with premium attribute ‘select_wrapper‘:
[taxonomy_chain_menu post_type=’product’ exclude=’89,105′ taxonomy=’product_cat’ target=’_blank’ label_taxonomy=’call_filter_chain1′ label_post=’call_filter_chain1-post’ button_title=’Take it!’ do_filter2=’woof’ watch_view=’post’ label_before=’Select your wear: ‘ select_wrapper=’selectron23′ chain_id=’chain1′ select_width=’300px|250px’ selectron23_max_open_height=’300′]
To make compatible with WPML in file functions.php added next code:
//[taxonomy_chain_menu label_taxonomy='call_filter_chain1' label_post='call_filter_chain1-post']
add_filter('chain1', function($args) {
$res = 'Wear Type|Gender|Model';
if (defined('ICL_LANGUAGE_CODE')) {
switch (ICL_LANGUAGE_CODE) {
case 'es':
$res = 'Tipo de ropa | Gender | Modello';
break;
case 'uk':
$res = 'Тип одягу | Стать | Модель';
break;
}
}
return $res;
}, 10, 1);
add_filter('chain1-post', function($args) {
$res = 'Your new wear';
if (defined('ICL_LANGUAGE_CODE')) {
switch (ICL_LANGUAGE_CODE) {
case 'es':
$res = 'Tu nueva ropa';
break;
case 'uk':
$res = 'Візьміть свій новий одяг';
break;
}
}
return $res;
}, 10, 1);
The same way is possible to adapt Taxonomy Chain Menu with another translation plugins.
For Selectron23 drop-down wrapper in file functions.php applied next code:
add_filter('taxonomy-chain-menu-option-data', function($id, $taxonomy, $parent_id, $chain_id) {
$data = [];
$get_thumbnail = function ($thumbnail_id, $size = 'thumbnail') {
$img = wp_get_attachment_image_src($thumbnail_id, $size);
if (!isset($img[0])) {
$img = wp_get_attachment_url($thumbnail_id);
} else {
$img = $img[0];
}
return $img;
};
//+++
if ($chain_id === 'chain1') {
if ($taxonomy === 'product_cat') {
$term_id = $id;
if ($term_id > 0) {
$data['text'] = strip_tags(tag_description($term_id));
$thumbnail_id = get_term_meta($term_id, 'thumbnail_id', true);
$data['img'] = $get_thumbnail($thumbnail_id);
} else {
//labels
$deep = 0;
if ($parent_id > 0) {
$deep = count(get_ancestors($parent_id, $taxonomy)) + 1;
}
switch ($deep) {
case 0:
$data['text'] = 'Best clothing types';
$data['img'] = $get_thumbnail(1378);
break;
case 1:
$data['text'] = 'Select your style';
$data['img'] = $get_thumbnail(1382);
break;
case 2:
$data['text'] = 'Best categories for you';
$data['img'] = $get_thumbnail(983);
break;
}
}
}
if ($taxonomy === 'is_post') {
$post_id = $id;
$data['text'] = 'Any short text about post here';
$data['img'] = $get_thumbnail(get_post_thumbnail_id($post_id)); //featured image
}
}
return $data;
}, 10, 4);
Documentation: https://pluginus.net/shop/wordpress-plugins/wordpress-filter-plugins/taxonomy-chain-menu/
