Title: Google friendly header idea from Codex?
Last modified: August 18, 2016

---

# Google friendly header idea from Codex?

 *  [Dgold](https://wordpress.org/support/users/dgold/)
 * (@dgold)
 * [20 years, 9 months ago](https://wordpress.org/support/topic/google-friendly-header-idea-from-codex/)
 * The following header code I found in the Codex, doesn’t work. Why? The error 
   message is “Parse error: parse error, unexpected ‘,’, expecting ‘)’ in /mysite/
   mysite/mysite/wp-content/themes/mysite/header.php on line 16
 * I started with code from this page of the Codex:
    [http://codex.wordpress.org/User:Yami_McMoots/My_Header](http://codex.wordpress.org/User:Yami_McMoots/My_Header)
 * So the behavior of wp_title() isn’t optimized for Googliciousness. Here’s how
   I have my page title set up in header.php:
 * `<title>
    <?php if (is_home () ) {  bloginfo('name');  } elseif ( is_category()){
   bloginfo('name'); echo ": "; single_cat_title();  } elseif (is_single() || is_page()){
   single_post_title(); } elseif (is_search() ) { bloginfo('name'); echo " search
   results: "; echo wp_specialchars($s); } else { wp_title(,true); }  ?> </title
   >
 * Can someone troubleshoot that code?

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

 *  [viper007bond](https://wordpress.org/support/users/viper007bond/)
 * (@viper007bond)
 * [20 years, 9 months ago](https://wordpress.org/support/topic/google-friendly-header-idea-from-codex/#post-251099)
 * `wp_title(,true);`
 * That is not valid PHP. Read this:
 * [http://codex.wordpress.org/Template_Tags/How_to_Pass_Tag_Parameters#Tags_with_PHP_function-style_parameters](http://codex.wordpress.org/Template_Tags/How_to_Pass_Tag_Parameters#Tags_with_PHP_function-style_parameters)
 *  Thread Starter [Dgold](https://wordpress.org/support/users/dgold/)
 * (@dgold)
 * [20 years, 9 months ago](https://wordpress.org/support/topic/google-friendly-header-idea-from-codex/#post-251119)
 * Thanks Viper. That helped me figure out how to fix it easily.
 * I like this on my blog, nice little improvement. For anyone who wants to try 
   it, replace this code in your Header.php –
 * `<title><?php bloginfo('name'); ?> <?php if ( is_single() ) { ?> &raquo; Archive
   <?php } ?> <?php wp_title(); ?></title>`
 * with this (my corrected code) –
 * `<title>
    <?php if (is_home () ) { bloginfo('name'); } elseif ( is_category()){
   bloginfo('name'); echo " - "; single_cat_title(); } elseif (is_single() || is_page()){
   single_post_title(); } elseif (is_search() ) { bloginfo('name'); echo " search
   results: "; echo wp_specialchars($s); } else { wp_title('',true); } ?> </title
   >
 * You’ll see the effect in your browser title bar, not in your blog header. I don’t
   know if this really helps with Google results, but it’s cool.
 * Now, if I can just figure out how to edit Yami’s original code I found on his
   User page in the Codex Wiki….?
 *  [aggressiveskater](https://wordpress.org/support/users/aggressiveskater/)
 * (@aggressiveskater)
 * [20 years, 2 months ago](https://wordpress.org/support/topic/google-friendly-header-idea-from-codex/#post-251389)
 * This works! I made the changes to my blog on friday and today (two days later),
   I am number one on google for the phrase "[aggressive skate blog](http://blog.rollerwarehouse.com)"!
   This one change made a huge difference.

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

The topic ‘Google friendly header idea from Codex?’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 3 replies
 * 3 participants
 * Last reply from: [aggressiveskater](https://wordpress.org/support/users/aggressiveskater/)
 * Last activity: [20 years, 2 months ago](https://wordpress.org/support/topic/google-friendly-header-idea-from-codex/#post-251389)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
