Skip to content

Instantly share code, notes, and snippets.

@kachi
Created April 16, 2012 05:05
Show Gist options
  • Select an option

  • Save kachi/2396410 to your computer and use it in GitHub Desktop.

Select an option

Save kachi/2396410 to your computer and use it in GitHub Desktop.
<?php if (strlen($post->post_title) > 30) {
echo mb_substr(the_title($before = '', $after = '', FALSE), 0, 30) . '...'; } else {
the_title();
} ?>
/*上記は30文字以降「...」で省略される*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment