WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] HTML entities in templates (13 posts)

  1. paryguy
    Member
    Posted 2 years ago #

    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?

  2. michael.mariart
    Member
    Posted 2 years ago #

    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.

  3. paryguy
    Member
    Posted 2 years ago #

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

    http://dev.sbgroovygrooms.com

    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.

  4. WPyogi
    Volunteer Moderator
    Posted 2 years ago #

    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.

    &deg;
    °
  5. paryguy
    Member
    Posted 2 years ago #

    WPyogi,

    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.

  6. Digital Raindrops
    Member
    Posted 2 years ago #

    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.

    HTH

    David

  7. paryguy
    Member
    Posted 2 years ago #

    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.

  8. michael.mariart
    Member
    Posted 2 years ago #

    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.

  9. Digital Raindrops
    Member
    Posted 2 years ago #

    EDITED looks like the answer ^^^^

  10. paryguy
    Member
    Posted 2 years ago #

    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.

  11. WPyogi
    Volunteer Moderator
    Posted 2 years ago #

    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.

  12. michael.mariart
    Member
    Posted 2 years ago #

    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.

  13. paryguy
    Member
    Posted 2 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic