Support » Fixing WordPress » Italics in post’s title

  • Hey, yet another question regarding my site: Is there a way to put italics into a PART of a post’s title and at the same time make the page validate correctly?

    Of course, I can use <em> tags, but this results in errors in xhtml validator.



Viewing 3 replies - 1 through 3 (of 3 total)
  • Use the_title_attribute inside title.
    Nice blog design.

    Thanks a lot for such a swift response, Haochi, but if I put it into a template file, wouldn’t it change the format of the whole title (and I want only last few words of it formatted in italics)?

    Or should I skip the template and put the_title_attribute directly into a post’s title in the WordPress compose message window? Sorry for the trouble, but my knowledge of PHP equals zero.

    Glad you liked the design:)


    Oh geez, I found the solution… Turned out that I misunderstood you completely and wanted to make things more complicated than they really were.

    I followed your instructions once again and changed the code in my index.php from

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


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

    and it worked perfectly. Stripped the title attribute of all html tags. Thanks!


Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Italics in post’s title’ is closed to new replies.