Automat as vrea si fara pluginuri pentru ca am anumite pluginuri care se bat cap in cap cu cele spuse de voi. Eu am avut functia urmatoare:
Cod PHP:
function trim_text($str, $len, $el = '...')
{
if (strlen($str) > $len) {
$xl = strlen($el);
if ($len < $xl) {
return substr($str, 0, $len);
}
$str = substr($str, 0, $len-$xl);
$spc = strrpos($str, ' ');
if ($spc > 0) {
$str = substr($str, 0, $spc);
}
return $str . $el;
}
return $str;
}
function etichetele ($sString){
return strtolower(trim(preg_replace("/([^a-zA-Z_-])+/", "-", $sString),""));
}
Cod HTML:
<meta name="keywords" content="retete, reteta, <?php $keyword=etichetele($post->post_title);
$keyword = explode("-",$keyword);
$nrk = count(explode("-",$keyword));
$i = 0;
$array = explode(",", $keyword);
$output = implode(",", $array);
foreach ($keyword as $eticheta) { if ($eticheta != "" && strlen($eticheta)>=3) {
echo"".$eticheta.", "; }}?>" />
<?php } ?>
In header.php am aceasta functie insa de la o vreme imi da urmatoarea eroare:
Cod HTML:
<meta name="keywords" content="retete, reteta, <br />
<b>Warning</b>: explode() expects parameter 2 to be string, array given in <b>/home2/user/public_html/numesite.ro/wp-content/themes/temamea/header.php</b> on line <b>29</b><br />
<br />
<b>Warning</b>: explode() expects parameter 2 to be string, array given in <b>/home2/user/public_html/numesite.ro/wp-content/themes/temamea/header.php</b> on line <b>31</b><br />
<br />
<b>Warning</b>: implode() [<a href='function.implode'>function.implode</a>]: Invalid arguments passed in <b>/home2/user/public_html/numesite.ro/wp-content/themes/temamea/header.php</b> on line <b>32</b><br />
cartofi, prajiti, " />
Keywordurile le pune ok insa afiseaza aceasta eroare si nu stiu de la ce ar putea fi.