Support » Fixing WordPress » Titles on posts appearing with HTML code rather than as normal

  • LucasClarkel

    (@lucasclarkel)


    I am over at thesimplegamers.com and at moment randoms posts have the link code appearing rather than the link itself. Its only happened to 3 posts out of all of them so far but I have not yet found a solid solution for it.

    Has anyone seen this before?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Michael

    (@alchymyth)

    Forum Moderator

    your theme seems to be using a plugin or build-in code to mark (multiple) capital letters;

    which seems to mess with the title attribute of the post title link:

    <h2><a title="If you like that shit, put a <span class="caps">LEGO</span> on it." href="http://thesimplegamers.com/putalegoonit/" rel="bookmark">If you like that shit, put a <span class="caps">LEGO</span> on it.</a></h2>

    also, the theme is not using the_title_attribute() in the linked post title (in index.php inside the loop).

    index.php (from the theme – wrong code):

    <h2><a title="<?php the_title(); ?>" href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h2>

    change that to:

    <h2><a title="<?php the_title_attribute(); ?>" href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h2>

    http://codex.wordpress.org/Function_Reference/the_title_attribute

    LucasClarkel

    (@lucasclarkel)

    That appears to have fixed it all. Thanks for that 😀

    Now everything doesn’t look stupid 😀

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Titles on posts appearing with HTML code rather than as normal’ is closed to new replies.