• I’m having problems with wp_title destroying numeric character references in my post titles. I use the following ‘title’ element:

    <title><?php bloginfo('name'); ?>: <?php wp_title('', true, 'left'); ?></title>

    If the title of my post is written ‘foo bar’, this is converted to ‘Blogname: foo bar’, i.e., the & character is wrongly encoded to &, so that the title of the page (shown in the title bar and in bookmarks) is ‘foo bar’.

    Note that using ‘the_title’ on the main page and post page works fine (& is not converted to &), but this is not appropriate for the XHTML ‘title‘ element, as this can’t contain HTML tags.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter huftis

    (@huftis)

    Obviously, this forum software also has a similar problem, and double-escaping doesn’t seem to help. I’ll try to explain the problem more closely:

    I use numeric character references (and other HTML stuff) in the title of my post, e.g. the concatenation of ‘foo’, an ampersand character, ‘#xa0;bar’. The problem is that this is displayed verbatim by wp_title (but not by the_title), and not as ‘foo’ followed by a hard space followed by ‘bar’. How can I fix this? It really feels more like a bug than a feature.

    In header.php delete the title code and paste the code for
    <title>
    <?php if(is_page(‘courses’)) { echo “websitename” » courses”; }else if(is_page(‘solutions’)){echo “websitename” » solutions”;}
    else {echo “websitename”;}
    ?>

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘wp_title destroying numeric character references’ is closed to new replies.