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

Ammu Nair
Ammu Nair
9,100 Points

Javascript file responsible for wordpress top menu bar ?

Hi,

I am currently taking the course - Creating a wordpress theme. When wp_footer is added to footer.php the javascript files are loaded, and a wordpress menubr appears on top. Could someone please tell me which javascript file in the project has the code to produce the html for the same ? Does it come inbuilt with wordpess? I currently have foundation, modernizr and app.js files in the script folder and I know app.js is not responsible for this. Could someone plz help so that I will have a better clarity? TIA Regards, Ammu

Doru Marginean
Doru Marginean
2,290 Points

Hi Ammu Nair,

If I understand correctly you are asking why you don't have some JS files into the HTML when removing wp_footer() from footer.php

The wp_footer() function contains the wp_footer action that prints scripts or data before the closing body tag on the front end.

So to answer your question you can change the last parameter of wp_enqueue_script() to false to put the script in header instead of footer. However you should not remove wp_footer() from footer.php under any circumstance.

More info here: https://developer.wordpress.org/reference/functions/wp_enqueue_script/