Merhaba;
Elimde böyle bir kod var ve bunu single.php ye yerleştirince çıktısı
Çiçek Modelleri şeklinde oluyor.
<?php
$posttags = get_the_tags();
$count=0; $sep='';
if ($posttags) {
echo '';
foreach($posttags as $tag) {
$count++;
echo $sep . ''.$tag->name.'';
$sep = ', ';
if( $count > 0 ) break; //change the number to adjust the count
}
}
?>ben
Çiçek Modelleri şeklindeki çıktıyı
cicek-modelleri şeklinde yapmak istiyorum nasıl yapabilirim acaba? Yani türkçe karakter yerine ingilizce karakter, boşluk yerine "-" olacak ve büyük harflerin hepsi küçük harf olacak.
Bu konuda yardım eden arkadaşlar inanılmaz makbule geçecekler, dilesinler benden ne dilerlerse
Temanızın functions.php dosyasına
function sef_link($baslik)
{
$baslik = str_replace(array(""","'"), NULL, $baslik);
$bul = array('Ç', 'Ş', 'Ğ', 'Ü', 'İ', 'Ö', 'ç', 'ş', 'ğ', 'ü', 'ö', 'ı', '-');
$yap = array('c', 's', 'g', 'u', 'i', 'o', 'c', 's', 'g', 'u', 'o', 'i', ' ');
$perma = strtolower(str_replace($bul, $yap, $baslik));
$perma = preg_replace("@[^A-Za-z0-9\-_]@i", ' ', $perma);
$perma = trim(preg_replace('/\s+/',' ', $perma));
$perma = str_replace(' ', '-', $perma);
return $perma;
}ekleyin kendi kodunuzuda bu şekilde değiştirin
<?php
$posttags = get_the_tags();
$count=0; $sep='';
if ($posttags) {
echo '';
foreach($posttags as $tag) {
$count++;
echo $sep . ''.sef_link($tag->name).'';
$sep = ', ';
if( $count > 0 ) break; //change the number to adjust the count
}
}
?>