Slug function is working perfectly in English but when I try to put Bangla it showing only ---
now showing:
input title: Top চাঁ mom কিন্তু মৈত্রী (কালো এলাচ)
output slug: top---mom----------
Need to show this way
input title: Top চাঁ mom কিন্তু মৈত্রী (কালো এলাচ)
output slug: Top-চাঁ-mom-কিন্তু-মৈত্রী-কালো-এলাচ
here below is my php function of slug in my blog.... how to fix this ???
function slug($text){
// replace non letter or digits by -
$text = preg_replace('~[^\\pL\d]+~u', '-', $text);
// trim
$text = trim($text, '-');
// transliterate
$text = iconv('utf-8', 'us-ascii//TRANSLIT', $text);
// lowercase
$text = strtolower($text);
// remove unwanted characters
$text = preg_replace('~[^-\w]+~', '', $text);
if (empty($text))
{
return 'n-a';
}
return $text;
}