user2684452
user2684452

Reputation: 731

Altering html structure and creating menu items in Wordpress

I'm fairly new to Wordpress and am trying to do something very specific. I am currently using the awesome html5blank to create my custom theme. I am using the native menus for my nav tabs. I am currently using background-image's to make my nav tabs images instead of text but that is posing problems with what I'm trying to achieve w/ css and making it responsive.

I want to be able to add <img> tags( different image for each <li> ) in my <li>'s via HTML.

As far as I've been able to find and read up, I need to create a custom structure in this found in my function.php file?

function html5blank_nav()
{
    wp_nav_menu(
    array(
        'theme_location'  => 'header-menu',
        'menu'            => '',
        'container'       => 'div',
        'container_class' => 'menu-{menu slug}-container',
        'container_id'    => '',
        'menu_class'      => 'menu',
        'menu_id'         => '',
        'echo'            => true,
        'fallback_cb'     => 'wp_page_menu',
        'before'          => '',
        'after'           => '',
        'link_before'     => '',
        'link_after'      => '',
        'items_wrap'      => '<ul>%3$s</ul>',
        'depth'           => 0,
        'walker'          => ''
        )
    );
}

Please let me know what else I need to provide to make this question make more sense and help you get me on the right track. Thanks in advance.

Upvotes: 0

Views: 122

Answers (1)

Stickers
Stickers

Reputation: 78776

It does not work that way. There are few options to do it:

  • Use CSS background. Each menu item will have some shared classes, also a unique class name you can work with, enough for you to add different background image for each. Read the Codex for more.

  • Well, if you REALLY need to add inline <img>, it doable but I would not recommend. Go to Appearances > Menus, and add a custom link to menu, and insert your <img> tag into the Navigation Label box.

  • OR simply don't use wp_nav_menu(), hard code your menu instead.

Upvotes: 1

Related Questions