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.

Leave a Comment