WordPress.org

Forums

Highlight or change color of word in title. (5 posts)

  1. cip6791
    Member
    Posted 4 years ago #

    Hello,

    I would like to highlight a word or change its color. The word is in the title. This word appears in all my post titles. So I would like it to be another color. Can that be done?

    Thank you.

  2. elfin
    Moderator
    Posted 4 years ago #

    you could try adding a filter to wp_title.

    edit: strike that, that won't work.

  3. elfin
    Moderator
    Posted 4 years ago #

    ahh yeah sorry it should be a filter on the_title

  4. cip6791
    Member
    Posted 4 years ago #

    What would that filter look like? :D

  5. elfin
    Moderator
    Posted 4 years ago #

    add_filter('the_title','my_retitle');
    function my_retitle($text){
    $text=str_replace('ReplaceMe','<span class="special">ReplaceMe</span>',$text);
    return $text;
    }

    I haven't fully tested it out though.

Topic Closed

This topic has been closed to new replies.

About this Topic