Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I don't have enough rep to comment but just curious why not use native WordPress menus? It'll make your life easier going down the road as well if you use wp_nav_menu(); </p> <p>See here: <a href="http://codex.wordpress.org/Function_Reference/wp_nav_menu" rel="nofollow">http://codex.wordpress.org/Function_Reference/wp_nav_menu</a></p> <p>Properly using a menu that way will automatically apply this class to the active menu item:</p> <pre><code>.current-menu-item </code></pre> <p>That's just native functionality. Let me know if you decide to go that way and I'll be happy to help.</p> <p>In your functions.php file add:</p> <pre><code>register_nav_menus('menu_slug' =&gt; 'Menu Name'); </code></pre> <p>This will allow you to assign a menu in the backend. Go to Appearance -> Menus.</p> <p>Then where you're trying to call the menu, add this code:</p> <pre><code>wp_nav_menu('menu'=&gt; 'menu_slug'); </code></pre> <p>That will then pull the menu you created in the backend. There are lots of arguments you can pass to that wp_nav_menu function as well.</p> <pre><code>$defaults = array( 'theme_location' =&gt; '', 'menu' =&gt; '', 'container' =&gt; 'div', 'container_class' =&gt; '', 'container_id' =&gt; '', 'menu_class' =&gt; 'menu', 'menu_id' =&gt; '', 'echo' =&gt; true, 'fallback_cb' =&gt; 'wp_page_menu', 'before' =&gt; '', 'after' =&gt; '', 'link_before' =&gt; '', 'link_after' =&gt; '', 'items_wrap' =&gt; '&lt;ul id="%1$s" class="%2$s"&gt;%3$s&lt;/ul&gt;', 'depth' =&gt; 0, 'walker' =&gt; '' </code></pre> <p>);</p> <p>If you use it this way, add this code to your theme and then:</p> <pre><code> wp_nav_menu ( $defaults ); </code></pre> <p>You'll notice if you do it that way, WordPress will automatically give the active menu item a current class. I hope this helps. This honestly is the best (right) way to do it. At some point you might want to switch the arrangement of menu items or add sub-menus or have a page you don't want to show. Using the menus like this will help you substantially. </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload