Title: Title outside loop.
Last modified: August 31, 2016

---

# Title outside loop.

 *  [gulliver](https://wordpress.org/support/users/gulliver/)
 * (@gulliver)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/title-outside-loop/)
 * I’ve just noticed that in one template of mine, <?php the_title(); ?> is outside
   the loop… but the title displays ok on the page.
 * I thought that tag could only be used within the loop.

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

 *  [Archana Solanki](https://wordpress.org/support/users/archanasolanki/)
 * (@archanasolanki)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/title-outside-loop/#post-7270148)
 * Hi there,
 * Yes, `the_title()` can be used within the loop only as mention here:
 * [https://codex.wordpress.org/Function_Reference/the_title](https://codex.wordpress.org/Function_Reference/the_title)
 * If you wish to get the title of the post outside the loop then you should use`
   get_the_title()` function of WordPress.
 * Please check once again. May be you are missing something. 🙂
 * Thanks,
    Archana.
 *  Thread Starter [gulliver](https://wordpress.org/support/users/gulliver/)
 * (@gulliver)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/title-outside-loop/#post-7270166)
 * >Please check once again.
 * Thanks.
 * A re-check shows ‘<?php the_title(); ?>’ before ‘<?php if (have_posts()) : while(
   have_posts()) : the_post(); ?>’ on a page using a custom template.
 * I’m bemused (unless that Codex info is out of date).
 * UPDATE: [This explains why it displays](http://wordpress.stackexchange.com/questions/116614/the-title-works-in-a-page-template-outside-the-loop-why).

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

The topic ‘Title outside loop.’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [gulliver](https://wordpress.org/support/users/gulliver/)
 * Last activity: [10 years, 2 months ago](https://wordpress.org/support/topic/title-outside-loop/#post-7270166)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
