WordPress.org

Support

Support » How-To and Troubleshooting » HTML in post title breaks validation

HTML in post title breaks validation

  • Hi

    When I put HTML in the post title field – to get italics, for eg – I get a “not valid xhtml” result from the validator:

    character “<” is the first character of a delimiter but occurred as data

    Is there an easy fix for this? Thanks

    Dave

    http://mediawatchwatch.org.uk

Viewing 5 replies - 1 through 5 (of 5 total)
  • You’ll need to use HTML Entities instead as < is a delimiter i.e.
    Use &lt; for < and &gt; for >

    Actually, rereading your post, what you’ll need to do is to change the following line in your theme’s index.php file from
    ...title="Permanent Link to <?php the_title(); ?>">...
    to something like
    ...title="Permanent Link to <?php htmlentities(the_title()); ?>">...

    BTW, if you want all the titles to be italicised, it is advised to use change the styling in your css file.

    Thanks. The php edit didn’t work at first, so I changed it back. Then, as if by magic, the page validated! All the > signs which were previously deal-breakers suddenly became mere “warnings”, and I got the badge. It may be because I fixed a separate “mailto:” error that everything else got fixed….

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘HTML in post title breaks validation’ is closed to new replies.
Skip to toolbar