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!
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
The 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(); ?>
<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(); ?>
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?
CANCEL PREVIOUS TRANSMISSION: I changed themes, then changed back to the one I was using in the first place, and the menu bar appeared. Poltergeist...
In 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 Puzzlewell11,938 Points
Thank 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!
I 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.