aboutjquery
aboutjquery

Reputation: 922

Add element inside wordpress menu

php

  <nav class="site-nav">
    <?php
      wp_nav_menu( array(
        'theme_location'  => 'primary',
        'container'       => false,
        'menu_class'      => 'nav-menu'
      ) );
    ?>
  </nav> <!-- .site-nav -->

How can i add some of element inside the menu like layout below

<ul class="nav-menu">
  <li><a href="#">link_1</a></li>
  <li><a href="#">link_1</a></li>
...
  <div class="new-element"> <!-- new element -->
    <span>something</span>
    <span>more</span>
  </div> <!-- new element end -->
</ul>

Thanks.

Upvotes: 0

Views: 186

Answers (2)

Stefan Dochow
Stefan Dochow

Reputation: 1454

Just do that in the Backend.

https://codex.wordpress.org/Function_Reference/wp_nav_menu states:

Displays a navigation menu created in the Appearance → Menus panel.

Upvotes: 1

Is very easy (not need enter code in your theme files). You only need go to WordPress Admin site in: Appearance --> Menus ---> Select the Menu and Add the new elements of Posts, Categories, Pages, etc...

View Image: [Add Menu Elements in WP]

Upvotes: 1

Related Questions