Support » Fixing WordPress » HTML entities in templates

  • Resolved paryguy


    I’m trying to add some custom code to a page template. For some reason, I’m sure there’s one I just don’t know it, I can’t add an html entity to the page. It just doesn’t show up. I’m trying to add the symbol for degrees with no luck. Is WP stripping this off my code?

Viewing 12 replies - 1 through 12 (of 12 total)
  • I don’t believe that WordPress would be stripping anything from your template file. The most likely reason is that you are not using the correct template file for the area that you are trying to edit. The templating sytem is relatively easy, but can still take a while to get used to, and the file names don’t help with making things easy to tranverse, so it might take a bit of searching to find the actual template file that you want to use.

    If you are 100% sure that you are using the right template file, add this at the top of it and see what happens.

    echo "<p>Forced Stop</p>";
    die ();

    Refresh the page, and see if you get the text ‘Forced Stop’ right at the end of your page with nothing else under it (also check in the source code just in case). If it’s there, then you are using the right template file, but if it’s not there you are not using the right template file.

    Thanks for quick response. I am seeing Forced Stop, you can see for yourself here:

    This is the code I’m trying to use:

    <h1><?= $temp_f ?> &deg; and <?= $cond?> -- <?= $langStr ?></h1>

    The degree sign is just not showing up, nothing is showing up where that should be. Everything else works great.

    Are you using the html special character code for that? If not, try using one of these where you want the degree symbol to be.



    I tried using both the ASCII character and the HTML entity…or hex value whatever it’s called. I used both and still nothing. Same for an emdash, they just won’t show up.

    I just tested this and it works, just remove the spaces after the &.

    This is a HTML Degree & #176; or this & deg;

    This is a HTML Degree ° or this °

    Paste your bit of code so we can see, if this is not resolved.



    Just tested it again, this time by concatenating the degree symbol onto the temp integer in the php code, still nothing. I can’t get any HTML entity to show up.

    I have your answer. It’s something that no one here would hav ethought of, but it’s tripped me up before.

    I only reasiled when I looked at your sites HTML using FireBug.

    You’ve got your H1 tag set up using Cufon to create pretty fonts. That is where your problem lies.

    99.9999% of the time, Cufon fonts don’t include any of the “extra” symbols like degrees. Sometimes they don’t include anything like a standard dash.

    You have two choices. Either keep Cufon, and just spell out degrees in plain English, or remove Cufon and display the degrees symbol.

    EDITED looks like the answer ^^^^

    Thanks Michael, I didn’t even realize that’s what was happening. I’m not even sure where it’s calling that from, looks like I’ll have some more digging.

    FYI, I tried the line of code on my local machine (MAMP) and it works fine, displaying the degree symbol…so sounds like Michael is right.

    Cufon is normally part of the themes structure. Most times there’s a setting that can turn it on or off. Be warned that turning it off will revert that text back to the standard web-safe font so it won’t be as visually appealing.

    If there’s nothing in the admin area, you can always modify the themes template files to remove the Cufon references and that will also stop it, but it’s not the best way to do it.

    Michael that was it! Just removed the h1 reference in the js file and BAM! there it is, that lovely little symbol. Thanks again to everyone who posted.

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘HTML entities in templates’ is closed to new replies.