• I’m currently using the following code to truncate titles on our features slider:

    <?php $tit = the_title('','',FALSE); echo substr($tit, 0, 36); if (strlen($tit) > 36) echo "..."; ?>

    The limit is, of course, 36 characters, but some titles appear shorter due to the inclusion of symbols. For example:

    Attack on Titan game by Omega Force … (36 charas)

    vs.

    Final Fantasy XV ‘Dawn’ … (23 charas)

    I imagine this is because of the HTML that’s actually output to add the single quotations, which brings the character count to 35 (two additional spaces added below, otherwise they’d turn into the symbols):

    Final Fantasy XV &#39 ;Dawn&#39 ; … (35 charas)

    Is there anyway to truncate titles without accounting for these symbols? The full title for the Final Fantasy XV story, for example, should be able to fit entirely (Final Fantasy XV ‘Dawn’ trailer). It’s rather bothersome to see some short titles entirely cut off because of symbol inclusion.

    Thanks!

  • The topic ‘Truncating Titles and Symbols’ is closed to new replies.