Support » Fixing WordPress » Numeric entities displaying on home page/excerpts

  • Resolved weazel


    Hi everyone!

    I can’t fathom this one out… If you look at the excerpts on the home page (, you will see that the theme is displaying numeric entities instead of en-dash, ampersands etc.

    Here is an example: the text looks like this in the full post:

    Tech:nology – one of London’s leading promoters of dark, underground Drum & Bass – once again takes over the world famous Scala in King’s Cross.

    But the theme displays the excerpt text on the home page like this instead:

    Tech:nology one of London’s leading promoters of dark, underground Drum & Bass once again takes over the world famous Scala…

    It is just the excerpts that have this problem. I’m not responsible for the uploading of the new content, but I’ve been assured that it’s being written directly in WordPress and no copied-and-pasted from Microsoft Word or anything.

    How can I fix this? Is it something I need to change in the code or is there a plug-in that will fix this throughout all the existing content?

    All ideas much appreciated…

    Thanks in advance,

Viewing 10 replies - 1 through 10 (of 10 total)
  • weazel


    Sorry – double post – and the entities aren’t displaying here. Please see the post excerpts on the homepage to see what I mean:




    Weird one this, it’s like it’s not converting html symbols into text-alternatives. Some of the codes like ‘–’ should be converted to a ‘-‘ on the site, but they’re not.

    I’m stumped on this one, but you could maybe hunt through the code to find where they are coming from and try manually adding in their html equivalent in your template files.



    Yeah – I can’t understand why the full posts are displaying them properly, but the excerpts are not. I have no idea where this is being set either.

    If I don’t get this fixed by Wednesday evening, I’m in trouble!



    Forum Moderator

    Does your theme’s index.php template file use <?php the_excerpt();?>?



    It doesn’t feature that exact line, but does feature:

    $excerpt = get_the_excerpt();


    <p><?php echo limit(150, $excerpt); ?></p>

    Both of those are within this chunk of code:

    [Code moderated as per the Forum Rules. Please use the pastebin]



    This might be a dumb question… Is “limit” a custom function in your theme’s functions.php file?



    Hmmm… I just found this in functions.php:

    // LImit caracters
    function limit($nb,$var) {
        $max= $nb;
           $var    = substr($var,0,$max);
           $espace = strrpos($var," ");
           $var    = substr($var,0,$espace)."...";
    	   $var    = htmlspecialchars($var);
        return $var ;

    Any use?

    (thank you for everyone’s help so far – I’m very grateful)



    Try removing the $var = htmlspecialchars($var); line.



    Brilliant – thank you! Removing that line seems to have fixed things.

    Thanks everyone for trying to help as well.



    Great. I realized afterwards that limit() might be used in other places on your theme, which need special chars converted (like meta description or whatever). I suppose a safer way would be leaving limit() intact, and creating an identical function without the offending line (call it limit2 or whatever).

    Then instead of <p><?php echo limit(150, $excerpt); ?></p> you would use <p><?php echo limit2(150, $excerpt); ?></p>, while other areas of your theme will still use the original with its special char conversion.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Numeric entities displaying on home page/excerpts’ is closed to new replies.