Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8486559
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T20:58:42+00:00 2026-06-10T20:58:42+00:00

I’m familiar with WordPress and using the WordPress menu system. But I’m looking for

  • 0

I’m familiar with WordPress and using the WordPress menu system. But I’m looking for a way to add custom HTML to wp_nav_menu().

I’m trying to create a menu like this:
enter image description here

Notice how the drop down menu under products contains an image and a link. I’d like to re-create this. I’ve looked at a few plugins, but would rather code it.

I don’t mind hard coding the image and link, but I’d like to keep the flexibility of using WordPress to manage the menus.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T20:58:44+00:00Added an answer on June 10, 2026 at 8:58 pm

    The way WordPress goes through the menu pages to display the items, is using a walker object. In this case the specific class for this object is called Walker_Nav_Menu. You can find it in wp-includes\nav-menu-template.php.

    The Walker_Nav_Menu is a pretty simple class. You are able to see, how the links and the menu structure are built there. The functions start_el and end_el are used to build the menu-items. Functions start_lvl and end_lvl are for nesting menus. In this approach we’ll be mainly using start_el and end_el.

    In your functions.php create a class, to extend Walker_Nav_Menu with pretty similar methods to the parent class:

    class Custom_Walker_Nav_Menu extends Walker_Nav_Menu {
      function start_el ( &$output, $item, $depth = 0, $args = array(), $id = 0 ) {
        // Copy all the start_el code from source, and modify
      }
    
      function end_el( &$output, $item, $depth = 0, $args = array() ) {
        // Copy all the end_el code from source, and modify
      }
    }
    

    In those functions, the $item is your menu-item, with which you can query additional contents according to the current menu-item, if you want to. Note that I didn’t include start_lvl and end_lvl, but that doesn’t matter, since your class will automatically inherit the parent classes methods, if not overwritten.

    Then, in your theme files, you can call wp_nav_menu like this:

    wp_nav_menu(array(
      'theme_location' => 'main',
      'container' => false,
      'menu_id' => 'nav',
      'depth' => 1,
      // This one is the important part:
      'walker' => new Custom_Walker_Nav_Menu
    ));
    

    WordPress will use your custom class and functions, so that you can modify what code is output.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
Basically, what I'm trying to create is a page of div tags, each has
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I have thousands of HTML files to process using Groovy/Java and I need to
I'm trying to create an if statement in PHP that prevents a single post
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
I am trying to understand how to use SyndicationItem to display feed which is
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
I have a jquery bug and I've been looking for hours now, I can't

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.