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 WordPress Theme Development WordPress Header and Footer Templates Porting existing headers and footers into WordPress

tarry nwaise
tarry nwaise
1,391 Points

Questions 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
Sue Dough
35,800 Points

You 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.

correct answer for Parameter echo URL

Bloginfo('url')

Daniel Peterson
Daniel Peterson
4,456 Points

Thanks for your help. I missed those 2 exact questions, even though I swear I entered the correct answers. But copy/pasting yours worked.

I 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?

Correct Answer echo date('Y')