私はWordpress内で開発していますが、PHPの知識は最小限です。タイトルには最初の単語しか表示されていません。変更するにはどうすればよいですか?これは私がそれが最初の言葉に制限されていると信じているところです。
function ShortenTitle($title){
// Change to the number of characters you want to display
$chars_max = 100;
$chars_text = strlen($title);
$title = $title."";
$title = substr($title,0,$chars_max);
$title = substr($title,0,strrpos($title,' '));
if ($chars_title > $chars_max)
{
$title = $title."...";
}
return $title;
}
function limit_content($str, $length) {
$str = strip_tags($str);
$str = explode(" ", $str);
return implode(" " , array_slice($str, 0, $length));
}