How can I append a <span> tag to a <h1> heading in WordPress

I need to add a spantag to an h1 heading in wordpress. I tried writing in through the CMS but it renders the spantag as text.
The site’s title is a name and I want to give different styles to the words.
Suggestions?

Following David Thomas‘s advice I’ve written this: but it appends the span last and empty.

<h1>
 <a href="<?php bloginfo('url'); ?>/">
  <?php             
    $completeName = bloginfo('name');
    $split = explode(" ",$completeName);
    echo $split[0]."<span>".$split[1]."</span>"
  ?>
 </a>
</h1>

Related posts

Leave a Reply

3 comments

  1. You should be using get_bloginfo as Felipe suggested, but still pass in the ‘name’ parameter.

    I was just working on the same code for the same reason and thought I should post for future visitors:

    <?php 
          $completeName = get_bloginfo('name');
          $nameParts = explode(" ", $completeName);
          echo '<span>'.$nameParts[0].'</span> '.$nameParts[1];
    ?>