Wordpress截断标题。

我有这个工作...但是。
<?php
$thetitle = $post->post_title; /* or you can use get_the_title() */
$getlength = mb_strlen($thetitle);
$thelength = 25;
echo mb_substr($thetitle, 0, $thelength);
if ($getlength > $thelength) echo \"...\";
?>
只需说标题为“嘿,你好吗”,并在“嘿,\”之后将其截短即可。 我要在逗号后和结尾引号之前消除一个空格。 有没有办法做到这一点?否则标题如下: 嘿... 代替: 嘿,... 谢谢     
已邀请:
echo trim(mb_substr($thetitle, 0, $thelength));
您只需要修剪空白。     

要回复问题请先登录注册