WordPress Short Title Length

- Written by

Last modified February 23, 2018

WordPress Short Title Length [ #1st -- 2011 ]

add_filter('...', '...')

function max_title_length( $title ) {
$max = 14;
if( strlen( $title ) > $max ) {
  return substr( $title, 0, $max ). " โ€ฆ";
  } else {
    return $title;
    }
}
add_filter( 'the_title', 'max_title_length');
--- last v. [ 2014 ]
<span>{ Php }</span>

function max_title_length( $title ) {
    if( mb_strlen( $title ) > 15 ) {
        return substr( $title, 0, 17 ). " โ€ฆ"; //use hellip;
    } else {
        return $title;
    }
}
add_filter( 'the_title', 'max_title_length'); //Optional
body {
  font-family: Consolas, Menlo, Monaco,
  Lucida Console, Liberation Mono,
  DejaVu Sans Mono, Bitstream Vera Sans Mono,
  Courier New, monospace, serif;
  font-size: 14px;
}

Result [ on the fly ]

iframe [ width + height = autoResizing ]

@webbeloz

 
ร—

Time expired..
- default (90 days)
- edit to (∞ days)
- Spamm Check

Leave a Comment

* Required: Name, eMail, Comment Emoji? : if(name) => start.eMail if(eMail) => start.Comment + Emoji (On/Off) ? a=* b=* c=31 (a + b = c) => Post a Comment enjoy(: tnx_wblz
OFF
ON
Check Url & "Not Allowed"
No Text /HTML