Version: 2.0.8 Plugin page: https://pluginus.net/shop/wordpress-plugins/wordpress-filter-plugins/taxonomy-chain-menu/ Demo pages: - http://cars.wp-filter.com/simple-taxonomy-chain-menu/ - http://woocommerce.wp-filter.com/simple-taxonomy-chain-menu-2/ - https://demo.posts-table.com/taxonomy-chain-menu/ - compatible with TABLEON - https://demo.products-tables.com/taxonomy-chain-menu/ - compatible with WOOT - https://demo.products-filter.com/taxonomy-chain-menu/ - compatible with WOOF filtration behavior Example of the shortcode: [taxonomy_chain_menu post_type='product' taxonomy='product_cat' parent_id=0 exclude='36,12' watch_view='posts' show_count=1 button_title='Watch It' target='_blank' label_taxonomy='Producer|Model' label_post='Select car' chain_id='chain1' connect_table='ttt1'] The shortcode attributes list: * post_type – what post type to use in the chain menu. Default type is 'post'. * taxonomy – what taxonomy terms to navigate. Default taxonomy is 'category'. * term_id – started term ID, 0 means all from the top. * exclude – terms ids to hide from the chain. For example: 12,44,73. * include – terms ids to show only. Opposite to 'exclude'. For example: 11,43,72. * include_top – terms ids related to the top only. For example: 10,42,71. * show_count – show/hide count of posts of the terms in drop-downs options. Default value is 0. * target – how to open selected post/terms. Default is: '_self' (opening in the same browser tab). To open in another tab use: '_blank' * watch_view – values: 'posts', 'terms', 'none'. What to show on the end of the chain. Posts - drop-down with posts. Terms - button with link to posts of the term selected in the last drop-down. None - nothing, good for products tables filtering. * label_taxonomy - label(s) of the drop-down(s). Example: Producer|Model * label_post - label of the posts drop-down Also it is possible to use custom actions (started from 'call_filter_') for translations, example: [taxonomy_chain_menu label_taxonomy='call_filter_chain1' label_post='call_filter_chain1-post'] In file functions.php add next code: add_filter('chain1', function($args) { $res = 'Producer|Model'; if (defined('ICL_LANGUAGE_CODE')) { switch (ICL_LANGUAGE_CODE) { case 'es': $res = 'Productor|Modelo'; break; case 'uk': $res = 'Виробник|Модель'; break; } } return $res; }, 10, 1); add_filter('chain1-post', function($args) { $res = 'Select car'; if (defined('ICL_LANGUAGE_CODE')) { switch (ICL_LANGUAGE_CODE) { case 'es': $res = 'Seleccionar coche'; break; case 'uk': $res = 'Яке твое авто'; break; } } return $res; }, 10, 1); * button_title – title for the button at the end of the chain. By default it is 'GO!'. It is also is possible to use action, example: //[taxonomy_chain_menu post_type='product' taxonomy='product_cat' button_title='call_filter_chain1-btn'] 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); * ready_chain - allows to display pre-selected values in the chain menu, example: [taxonomy_chain_menu watch_view='posts' ready_chain='17,20,post(51)'] - at the end of the chain will be displayed drop-down with posts and button with the link to the selected post. If exists more sub-categories use 0 (zero) at the end: [taxonomy_chain_menu ready_chain='17,20,0'] * chain_id - unique JavaScript identifier for js event 'taxonomy-chain-menu' and in custom WordPress actions * connect_table - unique identifier of posts/products table set in its shortcode attribute or backend settings. It is possible to use Taxonomy Chain Menu as filter with posts and products table plugins: TABLEON - WordPress Posts Table Filterable https://posts-table.com/ and WOOT - WooCommerce Products Table https://products-tables.com/ Such scripts cooperation is possible thanks to JavaScript event 'taxonomy-chain-menu' and shortcode attributes 'chain_id' with 'connect_table' * label_before - any words before first drop-down add_filter('chain1-before', function($args) { $res = 'Take our best products:'; if (defined('ICL_LANGUAGE_CODE')) { switch (ICL_LANGUAGE_CODE) { case 'es': $res = 'Toma nuestros mejores productos:'; break; case 'uk': $res = 'Візьміть наші найкращі продукти:'; break; } } return $res; }, 10, 1); * do_filter - accepted from the box only one value 'woof' (demo: https://demo.products-filter.com/taxonomy-chain-menu ), but it is possible to adapt any another wordpress/woocommerce filter plugin using js event taxonomy-chain-menu-do-filter and values there: e.detail.term_id, e.detail.slug, e.detail.container * select_wrapper - (from 2.0.8) has only one value 'selectron23' and allows to wrap drop-down in more reach html-element Selectron23 https://c2n.me/4bp12P2.png . Use with attribute 'chain_id' to separate functionality for different chain menus. Use hook 'taxonomy-chain-menu-option-data' to set all the data. See code example (add to file functions.php) below to set data in Selectron23 drop-down: 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); * select_width - (from 2.0.8) widths for drop-downs in chain. Use one value or some separated by '|'. Example: select_width='300px|200px|100px' * max_posts_count - (from 2.0.8) set maximum count of posts in posts drop-down * posts_orderby - (from 2.0.8) how to order by posts in posts drop-down (title, id, meta). By default title. * posts_order - (from 2.0.8) posts order direction in posts drop-down. Possible values: ASC, DESC * posts_order_meta_key - (from 2.0.8) here is meta key by which posts in posts drop-down should be ordered. Be care, meta values should exist in the requested posts. Example: [taxonomy_chain_menu post_slug='product' taxonomy='product_cat' posts_orderby='meta_value_num' posts_order_meta_key='prod_1' posts_order='DESC'] * selectron23_max_open_height - (from 2.0.8) works if wrapper selectron23 applied. Defines maximum drop-down height if opened, if drop-down is large vertical scroll appears. In px only. Value example: '150|200|300' - for first, second and third drop-down +++++++++++++++++++++++++++++++++++++++++++++++++++++ Hooks: - taxonomy-chain-menu-option-data: for data set when selectron23 applied - hook taxonomy-chain-menu-loader: to change loader image - taxonomy-chain-menu-do-filter: (for dev only) hook for filter plugins. In code called as: $.dispatchEvent(new CustomEvent('taxonomy-chain-menu-do-filter', {detail: {term_id, slug, container}}));