// each term
var menuInside = '';
var AllHtml = '';
$.each(sorted_data, function (index, val){
var icon_html = '';
var _class = filter_tax+'_'+ val[0] + ' '+ val[0];
// parent or child term
if( val[3] !== undefined && val[3] != '' && val[3] == 'n') _class += ' np';
//console.log(selected_terms);
// select or not
if( selected_terms == 'all' ) _class += ' select';
if( selected_terms.includes( val[0] ) ) _class += ' select';
// icon
if( val[2] != '' && val[2] !== undefined ){
_class += ' has_icon'; icon_html = val[2];
}
// tax term color
var _tax_color = '';
if( val[4] != '' && val[4] !== undefined ){
_tax_color = `style='background-color:#${val[4]};'`;
}
const itemHTML = `${icon_html} ${val[1]}`;
// save all value
if( val[0]=='all'){
AllHtml = itemHTML;
}else{
menuInside += itemHTML;
}
});
__menu_html += AllHtml + menuInside +"";
filter all first
Code created on: 2025-12-16 13:27:16