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 trialshareyourpeace
3,244 PointsWhen I include <?php wp_footer(); ?> into footer.php I am NOT getting the admin toolbar ?
This happened to me before and I WAS able to resolve it but I do not recall how ?
This is the code from the downloaded Projects Folder
functions.php
wp_enqueue_script( 'modernizr_js', get_template_directory_uri() . '/js/modernizr.js', '', '', false );
wp_enqueue_script( 'foundation_js', get_template_directory_uri() . '/js/foundation.min.js', array('jquery'), '', true );
wp_enqueue_script( 'main_js', get_template_directory_uri() . '/js/app.js', array('jquery', 'foundation_js'), '', true );
Why in the last line do we use 'foundation_js' rather than foundation.js ? Is this an error in the code that will stop the admin bar from showing up ?
A more generalized question is why do we in the first parameter of the scripts do we use the -underscore rather than a .dot ?
Thanks.
5 Answers
Jason Ziegler
Full Stack JavaScript Techdegree Graduate 39,583 PointsHi, I was also not showing the admin toolbar at the top of the screen.
I was getting 2 404 foundation.css not found errors in my console.
I realized I wasn't logged in and once I did, the toolbar showed up and the errors went away.
Mandeep Bhasin
1,475 PointsJason, thanks! Your method really helped me get the toolbar!
Maxime Sénécal
5,529 PointsThanks Jason !
Zac Gordon
Treehouse Guest TeacherHi,
The_js is incase you also wanted to have a foundation_css. Because they are unique handles just doing foundation on its own can potentially conflict or not be descriptive enough.
If you don't have any major errors and have wp_footer() the admin bar should show up. Do you have any JS or PHP errors?
shareyourpeace
3,244 PointsI have started from the beginning as mentioned.
Much quicker this time.
It was again, leaving that blank line after the ending ?>. In functions.php.
When I deleted this blank line, /wp-admin allowed me to login and the dashboard showed up.
General Clarification. I have a downloaded version of WordPress on my desktop. I just copied these files to my 'New Project'.
It seems just fine to reuse these wordpress files over and over since they have never been modified ? They just get copy-pasted over to the next project. Seems fine and logical to do to me and just checking.
thanks.
Zac Gordon
Treehouse Guest TeacherYes, you can reuse the same original download files.
Anthony Walker
4,448 PointsDid any of this actually answer why there is no wordpress panel at the top after adding the <?php wp_footer(); ?>
If it did it must have been written in encryption.
What is the actual solution as I have no wordpress bar
Anthony Walker
4,448 Pointsah deciphered the encryption....... log into wordpress. Should have remembered there is no panel unless you are logged in. Working fine now.......I think
shareyourpeace
3,244 Pointsshareyourpeace
3,244 PointsResolved. There are TWO things about this problem. Neither related to the scripts above.
1.
This is extremely simple but absolutely a very odd bug in php.
Wp-config.php change
define('WP_DEBUG', false);
to
define('WP_DEBUG', true);
and you will get error messages. This reminded me what I had to look at.
2a.
index.php
I was getting the header information and the word 'index' like the video.
I was NOT getting the footer info which had the black dashboard toolbar.
2b.
When I add 'wp-admin' to the end of the url,
I expected to get the wordpress login but instead
I was getting a WHITE screen with error messages that referenced the line and the file.
function.php
I had a BLANK line after the ending
?>
code, and when I deleted that blank line, problem resolved.
Hope this helps someone else :)