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