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 trialtarry nwaise
1,391 PointsQuestions from the Web Development quiz
These 2 questions were on the Web Theme Development Viedo Series Quiz under the section WordPress Header and Footer Templates
I tried the answer several ways and it keeps coming up wrong answer. The questions are:
1. These questions are from the Theme Development Video quiz in the section Headers and Footers I have tried to answer the questions below in several ways; however, I keep getting the answers wrong.
How would you echo out the current year in 4 digits using the PHP function?
I tried: echo date ('y') php echo echo date ('y') ?php echo echo date ('y'); ? <?php echo echo date ('y'); ?>
2. What function and parameter would you use to dynamically echo out the URL for a WordPress site? I tried: bloginfo ('url'); bloginfo ('url') <?php bloginfo ('url'); ?> bloginfo ('name'); bloginfo ('name') <?php bloginfo ('name'); ?>
None of the answers worked for either question. What should I have used?
Thanks.
-Tarry
-Tarry
3 Answers
Sue Dough
35,800 PointsYou can display the year like this
<?php echo date("Y") ?>
You could do this to show the home URL.
<?php $url = home_url();
echo $url;
?>
Say you want to add onto it though. You could use this and then put anything after the slash.
<?php echo esc_url( home_url( '/' ) ); ?>
Happy coding.
Annie Scott
27,613 Pointscorrect answer for Parameter echo URL
Bloginfo('url')
Daniel Peterson
4,456 PointsThanks for your help. I missed those 2 exact questions, even though I swear I entered the correct answers. But copy/pasting yours worked.
Fin Ch
41 PointsI ran into this issue as well. It should be bloginfo('url'), and even the video uses the lower case version. But the quiz requires you to use uppercase. Bug?
Annie Scott
27,613 PointsCorrect Answer echo date('Y')