WordPress.org

Ready to get started?Download WordPress

Forums

HTML in post title breaks validation (6 posts)

  1. DaveMcK
    Member
    Posted 9 years ago #

    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

  2. DaveMcK
    Member
    Posted 9 years ago #


  3. ifelse
    Member
    Posted 9 years ago #

    You'll need to use HTML Entities instead as < is a delimiter i.e.
    Use &lt; for < and &gt; for >

  4. ifelse
    Member
    Posted 9 years ago #

    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.

  5. DaveMcK
    Member
    Posted 9 years ago #

    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....

  6. DaveMcK
    Member
    Posted 9 years ago #


Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.