Forums

Apostrophe in title attribute of links (7 posts)

  1. juanlopez4691
    Member
    Posted 3 months ago #

    Apostrophe characters (', same as single quote) are replaced by double quotes (") in title attribute f entries links. If I insert a link like:
    El Zoo d'en <a href="http://whatever.com" title="Zoo d'en Pitus">Pitus</a>
    I get
    El Zoo d'en <a href="http://whatever.com" title="Zoo d"en Pitus">Pitus</a>
    Which breaks HTML code.

    I have been searching this forum and Google for a solution but found no definitive solution (disabling wptexturize doesn't seems to solve the problem). Any ideas?

  2. cais
    Member
    Posted 3 months ago #

    You can try using

    &apos;

    for the apostrophe in the title ... it's a bit clunky but should work.

  3. juanlopez4691
    Member
    Posted 3 months ago #

    I don't think it would work. I tried using
    &#039; but & (ampersand) char is replaced by its HTML entity &amp; and I get
    El Zoo d'en <a href="http://whatever.com" title="Zoo d&amp;#039;en Pitus">Pitus</a>

  4. doodlebee
    Member
    Posted 3 months ago #

    did you try a slash? Perhaps it's some weird PHP parsing thing:

    Zoo d\'en Pitus

  5. juanlopez4691
    Member
    Posted 3 months ago #

    Yes, I tried the slash, and then I get the slash displayed too.

  6. greenshady
    Member
    Posted 3 months ago #

    What's the code displaying this in your theme?

    It should be:

    <?php the_title_attribute(); ?>
  7. juanlopez4691
    Member
    Posted 3 months ago #

    greenshady, I am talking about links included as part of posts content. The HTML title attribute of those links is the problem (if there's an apostrophe in it).

Reply

You must log in to post.

About this Topic