Support » Themes and Templates » Getting my hamburger menu to work.

  • Hey WP Forums

    So i’ve got a menu that works via html + css (seen below)

    <!-- Header -->
    			<header id="header">
    				<a href="#menu">Menu</a>
    			</header>
    
    		<!-- Nav -->
    			<nav id="menu">
    				<ul class="links">
    					<li><a href="#">Home</a></li>
    					<li><a href="#">Item A</a></li>
    					<li><a href="#">Item B</a></li>
    				</ul>
    			</nav>

    Basically, the menu in the header, <a href="#menu">Menu</a>, shows the nav, <nav id="menu">, when clicked. Basically it’s a mobile menu but even on Desktop. However, i’m having problems getting it to work in my header.php

    This is what I have so far in my header.php:

    <!– Header –>

    <header id="header">
    				<a href="#menu">Menu</a>
    			</header>
    
    		<!-- Nav -->
    			<nav id="menu">		
    
    					<?php
    				wp_nav_menu( array(
    
    					'theme_location'	=> 'primary',
    					'container'			=> 'li',
    					'container_class'	=> 'links',
    					'menu_class'		=> 'links'
    
    				) );
    				?>
    			</nav>

    I’ve been reading through the codex to try and understand but to no avail. Any help or just a bump in the right direction is appreciated.

    Sorry for the poor foramtting, the copy pasting didn’t works so well.

  • The topic ‘Getting my hamburger menu to work.’ is closed to new replies.