WordPress.org

Forums

Customising #site-title (6 posts)

  1. canu
    Member
    Posted 3 years ago #

    The client would like #site-title (which is made up of 3 words) to be displayed in more than one colour, is this possible?

    Any help would be much appreciated.

    Thanks!

  2. potentweb
    Member
    Posted 3 years ago #

    Do you mean each word with a different color?

  3. canu
    Member
    Posted 3 years ago #

    I would like to have 2 different colours

  4. Michael
    Forum Moderator
    Posted 3 years ago #

    possibly not automatic - you would need to locate the code in header.php, and hard-code the site title with the individual words wrapped in spans with some css classes to allow the color formatting in style.css;
    or semi-automatic - separate the words of the site title, and automatically wrap them into spans.

    example:
    instead of (assumed):

    <?php bloginfo('name'); ?>

    use:

    <?php $site_title_words = explode( ' ', get_bloginfo('name') );
    $i = 1;
    foreach( $site_title_words as $word ) {
    echo '<span class="site-title-word-'.$i++.'">'.$word.'</span> ';
    } ?>

    the rest is formatting of the .site-title-word-1 { ... } etc styles.
    what theme are you using?

  5. canu
    Member
    Posted 3 years ago #

    Sorry for the delay, I'm using the Twenty Eleven theme

  6. David
    Member
    Posted 2 years ago #

    alchymyth, this is exactly what I was looking for. You advice is spot-on right. It worked perfectly.
    Thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic