Title: Title Errors
Last modified: August 18, 2016

---

# Title Errors

 *  Resolved [broomy](https://wordpress.org/support/users/broomy/)
 * (@broomy)
 * [19 years, 6 months ago](https://wordpress.org/support/topic/title-errors/)
 * This is driving me mad! I’m trying to make the bloginfo(‘name’) appear in the
   title tag on the homepage and the title of the post only on the post pages without
   anythink else. I’ve tried following the syntax but everything I try ends with
   an error (I admit i’m not the best with code!). Could anyone point out how to
   do this?
 * Thanks

Viewing 9 replies - 1 through 9 (of 9 total)

 *  [Kafkaesqui](https://wordpress.org/support/users/kafkaesqui/)
 * (@kafkaesqui)
 * [19 years, 6 months ago](https://wordpress.org/support/topic/title-errors/#post-479527)
 * Let’s see the code you have so far.
 *  [billh](https://wordpress.org/support/users/billh/)
 * (@billh)
 * [19 years, 6 months ago](https://wordpress.org/support/topic/title-errors/#post-479585)
 * If you are going to use the blog name in the title, you need to use the `get_bloginfo('
   name')` function as it is defined within the head HTML tags. The `bloginfo()`
   template tag is used only within the body HTML tags.
 *  [Kafkaesqui](https://wordpress.org/support/users/kafkaesqui/)
 * (@kafkaesqui)
 * [19 years, 6 months ago](https://wordpress.org/support/topic/title-errors/#post-479587)
 * Sorry billh, that’s not correct.
 * `bloginfo()` echoes or prints the value for the argument option that is passed
   to it.
 * `get_bloginfo()` returns the value, so you could assign it to a PHP variable 
   or such.
 * That’s the only real difference between the two functions. Either can be used
   anywhere within ones templates (well, within _reason_).
 *  Thread Starter [broomy](https://wordpress.org/support/users/broomy/)
 * (@broomy)
 * [19 years, 6 months ago](https://wordpress.org/support/topic/title-errors/#post-479609)
 * Thanks for the replies. I now have it working as follows:
 * `<?php if (is_home()){bloginfo('name');}else{ ?><?php wp_title(' '); ?><?php }?
   >`
 * Does this look right?
 *  [Kafkaesqui](https://wordpress.org/support/users/kafkaesqui/)
 * (@kafkaesqui)
 * [19 years, 6 months ago](https://wordpress.org/support/topic/title-errors/#post-479647)
 * If you’re asking if the logic is correct, that depends on if it’s outputting 
   the data the way you want it. You may combine your php tags:
 * `<?php if (is_home()) { bloginfo('name'); } else { wp_title(' '); } ?>`
 * but beyond that, things look fine from here.
 *  [koeln](https://wordpress.org/support/users/koeln/)
 * (@koeln)
 * [19 years, 6 months ago](https://wordpress.org/support/topic/title-errors/#post-479650)
 * You do not need the {} if there is just one line of code:
 * <?php if (is_home()) bloginfo(‘name’); else wp_title(‘ ‘); ?>
 *  Thread Starter [broomy](https://wordpress.org/support/users/broomy/)
 * (@broomy)
 * [19 years, 6 months ago](https://wordpress.org/support/topic/title-errors/#post-479816)
 * Great, thanks for your help.
 *  [billh](https://wordpress.org/support/users/billh/)
 * (@billh)
 * [19 years, 6 months ago](https://wordpress.org/support/topic/title-errors/#post-479915)
 * Kafkaesqui, when I read his question, I assumed incorrectly that he was working
   in the HTML head section. In my experience, flaky things happen when you use 
   the `bloginfo()` template tag there because nothing between the `<head>...</head
   >` tags is displayed to the browser except what is between the `<title>...</title
   >` HTML tags. After reading his posts further, I see he is working in the HTML
   body section, using the `wp_title()` template tag which is completely different.
 *  [Kafkaesqui](https://wordpress.org/support/users/kafkaesqui/)
 * (@kafkaesqui)
 * [19 years, 6 months ago](https://wordpress.org/support/topic/title-errors/#post-479943)
 * billh, **?**
 * Broomy noted in the first post the code is for the title tag, which is in the`
   <head>` of an X/HTML document.
 * I’m not sure what flakiness you’ve run across with bloginfo(), but my own templates
   make numerous calls to it throughout the `<head>`. And not just to display my
   blog’s name, but also for providing the default stylesheet url, and outputting‘
   alternate’ link tags for my syndication feeds.

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘Title Errors’ is closed to new replies.

## Tags

 * [tag](https://wordpress.org/support/topic-tag/tag/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 9 replies
 * 4 participants
 * Last reply from: [Kafkaesqui](https://wordpress.org/support/users/kafkaesqui/)
 * Last activity: [19 years, 6 months ago](https://wordpress.org/support/topic/title-errors/#post-479943)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
