如何解决Wordpress截断标题
我有这个工作...但是。<?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));
您只需要修剪空白。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。