Wordpress - Place page title in header?

If you only need the title you can request it outside the loop easily.

Try and call the_title() in your header. It should work

But you have to be aware that if you don't put a condition, each page of your website will display its title in the header section.

EDIT: the function to call is get_the_title($post->ID) since the_title() doesn't allow you to specify the post id as an argument. You can check on the Wordpress Codex for function allowing you to query information from your post outside the loop.


You need to use wp_title();

If you're trying to use the post title like so:

<head> 
 <title> post title here </title> 
</head>

You would need to add the wp_title(' ', true , ' ');

<head>
 <title> <?php wp_title('', true,''); ?> </title>
</head>

For example: If your post name was Hello World, Hello World would now show up in the tab.

http://codex.wordpress.org/Function_Reference/wp_title