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 trialKristin Koch
394 PointsDo you need to add wp_nav function?
If you've already created the html and css, why not just keep it as is in the header.php?
2 Answers
Joe Hartman
20,881 PointsBecause you can't change the html and css from the admin area. On a live site, if you wanted to make changes, you'd have to pull down a copy of the file from the server, edit it in your text editor and then reload it back to the server. Most people using Wordpress have no interest in making changes this way. They're much more comfortable using a graphical interface like the admin area to make changes on their site.
When you create or make changes to a menu in the admin area Wordpress generates the code for the menu. But how does it know where to put that code? What it does is look for a function called wp_nav_menu. When it finds it, that's where it places the code. You'll find this done repeatedly in Wordpress (and with dynamically-generated websites in general). Each page is made up of many smaller chunks of code combined together to make one page. There are many different hooks like the wp_nav_menu function that tell Wordpress what goes where.
Hope this helps. Good luck!
Kristin Koch
394 PointsThanks. This does.