jQuery(document).ready(function(){ jQuery('.filter_div .woo-products-product-categories').each(function(){ get_cat =''; jQuery(this).find('li').each(function(){ //get_cat += jQuery(this).find('a').text().toLowerCase().split(' ').join('-'); get_cat += jQuery(this).find('a').text().replace(/’/g, '').replace(/"/g, '').toLowerCase().split(' ').join('-'); get_cat += ' '; }); jQuery(this).parents('.woo-products-products__item').addClass(get_cat.replace(/'/g, '')); }); jQuery('.wooc_filter_main li').on( 'click', function() { jQuery(".wooc_filter_main li").removeClass('filter-active'); jQuery(this).addClass('filter-active'); get_target = jQuery(this).attr('data-filter'); if(get_target!='*'){ jQuery('.filter_div .woo-products-products__item').hide(); jQuery('.'+get_target).show(); }else{ jQuery('.filter_div .woo-products-products__item').show(); } //console.log(get_target); }); });
PHP Replace Quote and Cobvert to Lowercase
$filter = str_replace(" ", "-", $filter); $filter = str_replace(array("'", "\"", """), "", $filter);
Jagdish Sarma Asked question November 25, 2021