I need to generate li item with data- attribute while array.length < 0
Got a problem while concatenation. In result it's wrong li
I need: <li data-color='red, green, blue' data-size='1, 2, 3'>
But result is: <li data- color='red, green, blue' size='1, 2, 3'>
Code:
$filters_li = '<li class="textile-item"';
foreach($filters_labels as $label){
foreach($filters_fields as $field){
$filters_li .= 'data-'.$label.'="'. get_labels_as_tags($field, 1) . '"';
}
}
$filters_li .= '>';
Where is problem, I can't understand