根据此帖子remove everything after first comma from string in php
我需要在Wordpress中自定义此行:
<div class="text-center font-weight-bold" style="font-size: 16px; line-height: 16px; text-decoration: underline;">
<?php
echo rtrim( wp_trim_words( get_the_title(),2,'' ),',' );
?>
</div>
它的效果很好,但是某些产品标题的长度必须超过两个字,因此我需要在逗号字符之前输入所有字。