I’m looking for a way to add custom HTML to wp_nav_menu(). My menu is like this http://0808web.com/hdd/mihai/about-me/ and I cant find the way to make this dynamic in my personal theme in wordpress. I have this code in function.php

function richter_script_enqueue() {
        wp_enqueue_style('customstyle', get_template_directory_uri() . '/css/style.css', array(), '1.0.0', 'all');
        wp_enqueue_script('customjs', get_template_directory_uri() . '/js/jquery-3.1.1.js', array(), '1.0.0', '');
    }

    add_action('wp_enqueue_scripts', 'richter_script_enqueue');

    function richter_theme_setup() {
        register_nav_menus( array (
            'top-menu' => __('Top Menu', 'hallux'),
            ));
    }

    add_action('init', 'richter_theme_setup');  

and in header.php i have this code:

<body <?php body_class(); ?>>
        <!-- START Header -->
        <header class="wrapper-header">
            <i class="fa fa-bars" onclick="toggleMenu('menu')"></i>
            <?php wp_nav_menu(array(
                    'theme_location' => 'top-menu',
                    'container' => 'false',
                    'menu_class' => 'nav menu',

                )); ?>
            <!-- <nav id="menu" class="menu" data-opened="no">

                <a href="#home">Home</a>
                <a href="#about">About</a>
                <a href="#skills">Skills</a>
                <a href="#portfolio">Portfolio</a>
                <a href="#contact">Contact</a>
                <i class="fa fa-times" onclick="toggleMenu('menu')"></i>
            </nav> -->
            <div class="wrapper-img">
                <div class="flip-box-header">
                    <h4 class="header-img-back">Mihai Vasile <br>Junior Web Developer</h4>
                    <a class="flip" href="#"><img class="header-img" src="<?php echo get_template_directory_uri(); ?>/images/avatar.jpg" alt="Mihai Vasile" /></a>
                </div>
                <h1>Mihai Vasile</h1>
                <h2>Love developing websites and mobile apps</h2>
            </div>
        </header>

but i thing is missing something, could you help me with that pls.
Thank you a loot.

Read more here: How to add custom HTML to wp_nav_menu to have same menu like on my tpl?


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: