Code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php if (strlen($post->post_title) > 30) { | |
echo mb_substr(the_title($before = '', $after = '', FALSE), 0, 30) . '...'; } else { | |
the_title(); | |
} ?> | |
/*上記は30文字以降「...」で省略される*/ |
Screen shot
Note
Description | テーマファイル側で記事タイトルの出力される文字数を設定し、「…」を加える |
---|---|
WordPress Ver. | 3.3.1 |
Via | How to limit character on title |