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 trialEthan Rips
3,258 PointsThe WordPress menu bar doesn't appear on top of the page
The WordPress menu bar isn't showing as indicated in the video.
Here's my code:
index.php: <?php get_header(); ?> <h1>Index file</h1> <?php get_footer(); ?>
header.php: <!doctype html> <html class="no-js" lang="en"> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title><?php wp_title(); ?></title>
<?php wp_head(); ?>
</head>
<body> <header class="row no-max pad main"> <h1><a class='current' href="<?php bloginfo( 'url'); ?>"><?php bloginfo( 'name'); ?></a></h1> <a href="" class="nav-toggle"><span></span>Menu</a> <nav> <h1 class="open"><a class='current' href="<?php bloginfo( 'url'); ?>"><?php bloginfo( 'name'); ?></a></h1> <ul class="no-bullet"> <li class="current parent"><a class='current' href="index.html">Portfolio</a> <ul class="sub-menu"> <li><a href="item.html">Portfolio Item</a></li> <li><a href="item.html">Portfolio Item</a></li> <li><a href="item.html">Portfolio Item</a></li> <li><a href="item.html">Portfolio Item</a></li> </ul> </li> <li class="parent"><a href="blog.html">Blog</a> <ul class="sub-menu"> <li><a href="single-post.html">Single Post</a></li> <li><a href="author.html">Author Page</a></li> </ul> </li> <li><a href="about.html">About</a></li> <li><a href="contact.html">Contact</a></li> </ul> </nav> </header>
footer.php: <div class="footer-clear"></div> <footer class="row no-max pad"> <p>Copyright <?php echo date( 'Y' ); ?></p> </footer>
<?php wp_footer(); ?>
</body> </html>
I've examined & re-examined my code to no avail, and deleted my cache.
I've got WP_DEBUG on. However, I don't know how to use it. What should I be looking for when debugging, and where?
Please advise.
Thanks.
5 Answers
Ethan Rips
3,258 PointsCANCEL PREVIOUS TRANSMISSION: I changed themes, then changed back to the one I was using in the first place, and the menu bar appeared. Poltergeist...
Evan MacAlpine
7,173 Points+1 for posting this! I was having the exact same issue.
Andrea Crawford
1,276 PointsIn order for the wordpress menu to show at the top of the page, you must be logged in as a site admin. That menu does not show for all site users, only admins who are logged in to the site. In order to change your theme you had to log in, which would have made the menu appear on the page even if you hadn't switched themes and switched back.
Ravel Puzzlewell
11,938 PointsThank you for posting this! The exact same thing happened to me. I cleared my browser cache, but that didn't fix it, but changing themes and changing back fixed it. Saved me a lot of time coming through my code!
Nejc Vukovic
Full Stack JavaScript Techdegree Graduate 51,574 PointsI had the same problem. Funny thing is you only see the top bar if you visit the page directly from the WP Admin Dashboard using "Visit Site" link. If you try to open the site directly with the URL then no bar is shown.
Tyler _
6,651 PointsI still can't see the menu bar at top and I'm logged in as Admin.
Evan MacAlpine
7,173 Points@Tyler _. Did you try switching themes and then switching back? That worked for me.
Ethan Rips
3,258 PointsEthan Rips
3,258 PointsSorry--I made the mistake of copying this stuff into Emacs before pasting it in here.
Here's index.php's content:
<?php get_header(); ?> <h1>Index file</h1> <?php get_footer(); ?>
Here's header.php: <!doctype html> <html class="no-js" lang="en"> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title><?php wp_title(); ?></title>
<?php wp_head(); ?>
</head>
<body> <header class="row no-max pad main"> <h1><a class='current' href="<?php bloginfo( 'url'); ?>"><?php bloginfo( 'name'); ?></a></h1> <a href="" class="nav-toggle"><span></span>Menu</a> <nav> <h1 class="open"><a class='current' href="<?php bloginfo( 'url'); ?>"><?php bloginfo( 'name'); ?></a></h1> <ul class="no-bullet"> <li class="current parent"><a class='current' href="index.html">Portfolio</a> <ul class="sub-menu"> <li><a href="item.html">Portfolio Item</a></li> <li><a href="item.html">Portfolio Item</a></li> <li><a href="item.html">Portfolio Item</a></li> <li><a href="item.html">Portfolio Item</a></li> </ul> </li> <li class="parent"><a href="blog.html">Blog</a> <ul class="sub-menu"> <li><a href="single-post.html">Single Post</a></li> <li><a href="author.html">Author Page</a></li> </ul> </li> <li><a href="about.html">About</a></li> <li><a href="contact.html">Contact</a></li> </ul> </nav> </header>
And here's footer.php: <div class="footer-clear"></div> <footer class="row no-max pad"> <p>Copyright <?php echo date( 'Y' ); ?></p> </footer>
<?php wp_footer(); ?>
</body> </html>