WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to style parts of bloginfo name from a filter. The only thing I want to do is change the site-title of the blog to include HTML so that I can do individual font-settings on part of the name.

I'm using the twentyeleven and wonder how I can do this in a filter.

When I add a filter for bloginfo and modify the name, it gets modified also in the title of the page and in the title attribute of the A element. I would only like to modify the bloginfo['name'] that is shown inside the A element.

Is there someway possible to check the context you are in while the filter callback is called for more fine grained control of the output?

share|improve this question

You can't check the context while the filter callback is called, because the element is already in the frontend. There are 3 solutions though:

1. jQuery

Search for the element and add html to the places in the name.

2. PHP in element

Get the bloginfo('name'); in the element and change it on that place using PHP.

3. PHP in header

Add HTML to your bloginfo('name') and strip it back out in de header.php file where the title is generated using the strip_tags() function:


I'd go with the 3rd option, since it's the fastest method without changing to much.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.