Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress PHP for WordPress PHP Basics for WordPress PHP Basics for WordPress Quiz

Marie Josée Laporte
Marie Josée Laporte
8,188 Points

Write out the template tag that let's you echo out the title of a post or page:

what is the answer?

2 Answers

Alex Flores
Alex Flores
7,864 Points

You're looking for a template tag that let's you echo out the title of a post or page? I'm not sure I follow, as even the built-in WordPress themes automatically show the title of the post/page. However, if you're creating a new template, you can add the title of a post/page by going to functions.php and adding:

add_theme_support( 'title-tag' );

If you just want to echo out the page/post title in a template you're creating (e.g., single-post.php), you can write:

<?php 
     echo get_the_title();
?> 

Hope this helps