WordPress.org

Ready to get started?Download WordPress

Forums

Italics in post's title (4 posts)

  1. karakter
    Member
    Posted 6 years ago #

    Hey, yet another question regarding my site: http://www.karakter.pl. 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.

    Cheers,

    k

  2. haochi
    Member
    Posted 6 years ago #

    Use the_title_attribute inside title.
    Nice blog design.

  3. karakter
    Member
    Posted 6 years ago #

    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:)

    k

  4. karakter
    Member
    Posted 6 years ago #

    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>

    into

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

    k

Topic Closed

This topic has been closed to new replies.

About this Topic