Taxonomy Chain Menu – is simple WordPress plugin with one shortcode, which allows to create taxonomies terms chain menus with any inbuilt and custom types of WordPress taxonomies. Is compatible with WOOT – WooCommerce Active Products Tables!
Buy it separately on: pluginus.net OR Use free version: wordpress.org
Created by shortcodes: [taxonomy_chain_menu post_type=’product’ exclude=’152,84′ taxonomy=’product_cat’ target=’_blank’ label_taxonomy=’call_filter_chain1′ label_post=’call_filter_chain1-post’ chain_id=’chain1′ connect_table=’tt1′ button_title=’call_filter_chain1-btn’ label_before=’Select your wear: ‘ select_width=’300px|250px’] AND [woot id=1 disable_filter_form=1]
Attention:
- target=’_blank’ – this attribute is from premium version of the plugin
- label_taxonomy=’Clothes|Model’ – such syntax is from premium version of the plugin
- label_before – this attribute is from premium version of the plugin
The same shortcode but with premium attribute ‘select_wrapper‘:
In file functions.php added next code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
//[taxonomy_chain_menu label_taxonomy='call_filter_chain1' label_post='call_filter_chain1-post'] add_filter('chain1', function($args) { $res = 'Clothes|Model'; if (defined('ICL_LANGUAGE_CODE')) { switch (ICL_LANGUAGE_CODE) { case 'es': $res = 'Ropa | Modelo'; 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); add_filter('chain1-btn', function($args) { $res = 'Take it!'; if (defined('ICL_LANGUAGE_CODE')) { switch (ICL_LANGUAGE_CODE) { case 'es': $res = 'Tomar lo!'; break; case 'uk': $res = 'Забираймо!'; break; } } return $res; }, 10, 1); |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
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 producers'; $data['img'] = $get_thumbnail(31); break; case 1: $data['text'] = 'Best models'; $data['img'] = $get_thumbnail(32); break; case 2: $data['text'] = 'Best sub-models'; $data['img'] = $get_thumbnail(30); 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/