WordPress custom Nav Walker

You don’t need to write a custom walker to achieve this. You can modify the output of the wp_nav_menu() function and hook into the appropriate default nav menu filter to modify the output of the individual menu items. E.g. (assuming your theme menu location is called primary)

Put this in your functions.php file

/**
 * Output Custom Menu
 * 
 * Call this function within your template
 * files wherever you want to output your
 * custom menu.
 * 
 */
function custom_theme_menu() {
    $menu = wp_nav_menu( array(
    'theme_location'  => 'primary',
    'container_class' => 'menu',
    'items_wrap'      => '%3$s', // needed to remove the <ul> container tags
    'fallback_cb'     => false,
    'echo'            => false
    ) );

    // Strip out the <li> tags from the output.
    echo strip_tags( $menu,'<a>, <div>' );
}


/**
 * Add Nav Menu Item Link Classes
 * 
 * Detects if we are rendering the custom menu
 * and adds the appropriate classnames.
 * 
 */
function custom_theme_nav_menu_link_attributes( $atts, $item, $args, $depth ) {
    // For all other menus return the defaults.
    if ( $args->theme_location !== 'primary' ) {
        return $atts;
    }

    // Add the link classes.
    $class_names = array( 'some-class' );

    if ( $item->current ) {
        $class_names[] = 'is-active';
    }

    $atts['class'] = join( ' ', $class_names );
    return $atts;
}
add_filter( 'nav_menu_link_attributes', 'custom_theme_nav_menu_link_attributes', 10, 4 );

Then in your template files just call the following function wherever you want to output the menu:

custom_theme_menu();

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)