ThemeShaper Forums » Thematic

[closed]

Changing the blog-title colour

(6 posts)
  • Started 7 years ago by proto
  • Latest reply from proto
  • This topic is resolved
  1. proto
    Member

    Hello All,

    I have a blog title called pixelwoo. I'd like to change the blog title so the "woo" part of the title appears in a different colour. After looking in these forums I saw the great work Helga had done helping someone with a similar problem, in which she posted the code to do this. Here's the thread:

    http://forums.themeshaper.com/topic/looking-for-ltdiv-idblog-titlegt

    The code that I'm using, directly from that thread is:

    // --- Change the colour of the Title "woo" section
    
    function pixelwoo_change_blogtitle() { 
    
    $title = get_bloginfo('name');
    $title = str_replace('woo','<span class="colourchange">woo</span>',$title);
    
    ?>
    
    <div id="blog-title"><span><a href="<?php bloginfo('url') ?>/"
    title="<?php bloginfo('name') ?>" rel="home"><?php echo $title ?>
    </a></span></div>
    
    <?php }
    
    add_filter('thematic_blogtitle','pixelwoo_change_blogtitle');

    I don't know if it makes a difference but I've also overidden the blog title to give it a class as follows:

    // Add a class to the blog title
    
    function childtheme_override_blogtitle()  {
    	 ?>
    <div id="blog-title" class="grid_4"><span><a href="
    <?php echo home_url() ?>/" title="<?php bloginfo('name') ?>"
    rel="home"><?php bloginfo('name') ?></a></span></div>
    
    		<?php
    		}
    
    	add_action('thematic_header','thematic_blogtitle',3);

    My changing the blog-title appears after my adding a class to the blog-title in my "functions.php" file.
    !
    Any thoughts greatly appreciated! :)

    Posted 7 years ago #
  2. proto
    Member

    Ok... I'll try a good old fashioned bump. If any other other folks out there can help let me know!

    Thanks! I just want to change the colour of part of my blog title. If there's another way I'm all ears!

    Posted 7 years ago #
  3. sorry, from reading your first post, i thought you had it working. 1. my filter function is all kinds of messed up, BUT 2. in header-extensions.php there is no thematic_blogtitle filter. i don't know if it was deprecated or if i just didn't know what i was doing. although it DID work for me.

    SO, your override approach is correct, but you still need the string matching from my original post.

    // Add a class to the blog title
    
    function childtheme_override_blogtitle()  {
    
    $title = get_bloginfo('name');
    $title = str_replace('woo','<span class="colourchange">woo</span>',$title);
    
    ?>
    <div id="blog-title" class="grid_4"><span><a href="
    <?php echo home_url() ?>/" title="<?php echo $title; ?>"
    rel="home"><?php bloginfo('name') ?></a></span></div>
    
    <?php }

    untested so be wary of typos.

    Posted 7 years ago #
  4. proto
    Member

    Helga,

    Thank you. I had to tweak the code a little but thanks to you it now works. For those that are reading this wanting to do the same thing here's the code:

    // Add a class to change the colour of part of my blog-title
    
    function childtheme_override_blogtitle()  {
    
    $title = get_bloginfo('name');
    $title = str_replace('woo','<span class="colourchange">woo</span>',$title);
    
    ?>
    <div id="blog-title" class="grid_4"><span><a href="
    <?php echo home_url() ?>/" title="<?php bloginfo('name') ?>" rel="home">
    <?php echo $title; ?></a></span></div>
    
    <?php }

    Then just add the css in your stylesheet, eg:

    .colourchange {color: #da1519;}

    Obviously change the 'woo' text and the hex colour to whatever you'd like it to be. I hope this helps someone - thank you Helga!

    Posted 7 years ago #
  5. if you are using the latest version of thematic, you don't need to use add_action. i guess i just blindly copied it w/o noticing. i've edited both our codes.

    Posted 7 years ago #
  6. proto
    Member

    Thanks Helga,

    Excuse me for asking a silly question. So in all the textbooks I use they do the add_action etc? So is this new thematic streamlined so it's not necessary to add_action?

    Assume you still have to filter in the normal way - add_filter('img_caption_shortcode', 'my_img_caption_shortcode_filter',10,3); or is this the same as add_action? Any other major code bits where it's not necessary to use the final line of code saying where etc?

    I suppose this is some streamlining of thematic and making coding for it leaner?

    Posted 7 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.