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 trialFaddah Wolf
12,811 Pointswhy isn't single_post_title() the correct answer??
I am doing the WordPress Development track and am in the quiz for PHP for WordPress. The question asks — write out the template tag to echo out the title of a page of post. That is listed in both the WordPress Codex for Template Tags and in the common theme WordPress index.php file as single_post_title(). However, when I put that as the answer, it keeps telling me "Bummer!" and saying it's wrong. I have now reviewed the video and WordPress Codex on template tags several times, and all tried wp_title(), and nothing shows as correct for this answer. I don't feel this material was properly gone over in any of the videos. What is going on here, please?
— faddah portland, oregon, u.s.a.
2 Answers
Tim Knight
28,888 PointsHi Faddah,
What you're looking for is actually the_title()
. You can read more information about that at https://codex.wordpress.org/Function_Reference/the_title. Using the_title()
references the current post's title where wp_title() is the default title of the blog/site.
Faddah Wolf
12,811 PointsThank you. However, that is not covered well in the videos or material, at all. What is shown in the videos and in index.php is single_post_title()
. I feel someone should inform Zac Gordon and/or whomever else put together this course and it should be clearer in the videos or the quiz should be changed, please. That is my suggestion.
best,
— faddah portland, oregon, u.s.a.
Tim Knight
28,888 PointsYou're right Faddah, it really isn't. You might consider sending an email to help@teamtreehouse.com just to let them know your feedback directly. I think what they were probably trying to do, based on the "Template Tags" video was to give you a reason to navigation and look through the various template tags within the https://codex.wordpress.org/Template_Tags page that Zac Gordon was showing you. But you're right, it could probably be much more clear.