• Resolved outsourcenow

    (@outsourcenow)


    Hi,

    I wonder if you know how to add tag <a> in navbar menu for example:

    <nav class="m-nav">
       <p class="text-mild-blue">Menu</p>
         <ul>
            <li><a href="/">Home</a></li>
            <li><a href="about/">About</a></li>
            <li><a href="courses/">Courses</a></li>
            <li><a href="news/">News</a></li>
            <li><a href="contact/">Contact</a></li>
        </ul>
    </nav>

    header.php:

    <nav class="m-nav">
        <p class="text-mild-blue">Menu</p>
            <?php
    	    wp_nav_menu( array(
    	    'theme_location' =>  'menu-1',
    	    'menu_id'        =>  'primary-menu',
    	    'menu_class'     =>  '',
    	    'container'      =>	 'ul',
    	    'container_class'=>  ''	
    	    ) );
    	?>
    </nav>

    I would like to add tags into a class.

    Thanks,

    Shaun.

    • This topic was modified 7 years, 4 months ago by bcworkz. Reason: code fixed
Viewing 5 replies - 1 through 5 (of 5 total)
  • can you more elaborate

    Thread Starter outsourcenow

    (@outsourcenow)

    I would like to add class inside anchor in wp_nav_menu but how do I add it?

    Thanks,

    Shaun.

    Moderator bcworkz

    (@bcworkz)

    The wp_nav_menu() function has several filters in which it’s possible to change the or add classes. You could also utilize a customized walker to selectively manage what happens where.

    When you post code, please use backticks or the code button. Otherwise your code can be corrupted and unusable. Sometimes even unreadable.

    Hi outsourcenow (@outsourcenow)

    <nav class="m-nav">
     <p class="text-mild-blue">Menu</p>
      <?php
        wp_nav_menu( array(
        'theme_location' =>  'menu-1',
        'menu_id'        =>  'primary-menu',
        'menu_class'     =>  '',
        'container'      =>	 'ul',
        'container_class'=>  ''	
        ) );
      ?>
    </nav>

    Add class in container_class like this.
    'container_class'=> 'links',

    I hope it work.

    [Moderator note: code fixed. Please wrap code in the backtick character or use the code button. If you do not, your helpful code is rendered unusable by the forum’s parser.]

    Thread Starter outsourcenow

    (@outsourcenow)

    hi guru985 (@guru985),

    I mean <a class="THIS ONE" href="https://localhost:8888/homle-valley-primary-school/">Home</a>

    Thanks,

    Shaun.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How to add tags in menu’ is closed to new replies.