Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm getting really desperate and I need your help, I really tried and research and I couldn't find anything yet. I'm new at wordpress.. and I have this question, I hope you can help me...

I want to create a navigation menu just like this:

enter image description here I already used the class Walker_Nav_Menu and adapted the code to show the menu how I wanted, but this is not what wordpress is about, because the user would have to put the images manually in the right directory and with the right name. This is the code I use:


class My_Walker extends Walker_Nav_Menu {

function start_el(&$output, $item, $depth, $args) {
    global $wp_query;
    $indent = ( $depth ) ? str_repeat("\t", $depth) : '';

    $class_names = $value = '';

    $classes = empty($item->classes) ? array() : (array) $item->classes;

    $class_names = join(' ', apply_filters('nav_menu_css_class', array_filter($classes), $item));
    $class_names = ' class="' . esc_attr($class_names) . '"';

    $output .= $indent . '<li id="menu-item-' . $item->ID . '"' . $value . $class_names . '>';

    $attributes = !empty($item->attr_title) ? ' title="' . esc_attr($item->attr_title) . '"' : '';
    $attributes .=!empty($item->target) ? ' target="' . esc_attr($item->target) . '"' : '';
    $attributes .=!empty($item->xfn) ? ' rel="' . esc_attr($item->xfn) . '"' : '';
    $attributes .=!empty($item->url) ? ' href="' . esc_attr($item->url) . '"' : '';

    $item_output = $args->before;
    $item_output .= '<a' . $attributes . '>';

    $item_output .= '<div id="list-links-image"> <img src="wp-content/themes/pnsr/images/index/pnsr-' . strtolower($item->title) . '.png" /> </div>';
    $item_output .= '<div id="list-links-text">' . $item->title . '</div>';
    $item_output .= '<div id="list-pages-description">' . $item->description . '</div>';
    $item_output .= '<div id="list-pages-more"> Ver m&aacute;s </div>';
    $item_output .= '</a>';

    $item_output .= $args->after;

    $output .= apply_filters('walker_nav_menu_start_el', $item_output, $item, $depth, $args);

}

}

Anyone know about a plugin or code to do this? Please.

share|improve this question
1  
Does this code work already and you're just trying to modify it so others can use it, or is some aspect of it not working? Plugin recommendations are off-topic, but if you can clarify what you've tried so far it'll help folks who are trying to help you. –  morganestes Mar 11 at 20:38
    
With "Users" I mean the person who is going to manage the wordpress site, Thanks for your answer, but I already found a solution. Bye. –  DianeW Mar 11 at 22:32
    
Would you mind posting your solution as an answer so others can learn from it? –  morganestes Mar 11 at 22:46

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.