更改wordpress中的子菜单类

When using wp_nav_menu in my theme, I want to change Worpdress' default sub-menu class for items that contain a child list (to dropdown to fit for the Foundation framework).

I have reviewed this post on the topic but I cannot seem to get it to function correctly.

In my functions.php file I have inserted:

class My_Sub_Menu extends Walker_Nav_Menu {
  function start_lvl(&$output, $depth) {
    $indent = str_repeat("\t", $depth);
    $output .= "
$indent<ul class=\"dropdown\">
";
  }
}

And in my header.php file I have:

<?php
    $defaults = array(
        'theme_location'  => 'header-nav',
        'menu_class'      => 'right',
        'walker'          => new My_Sub_Menu(),
        'container'       =>  false
    );
    wp_nav_menu( $defaults );
?>

But nothing occurs. Am I misunderstanding where to insert the code?

Is it because you haven't specified an end_lvl for your class My_Sub_Menu extends Walker_Nav_Menu?

class My_Sub_Menu extends Walker_Nav_Menu {
  function start_lvl(&$output, $depth) {
    $indent = str_repeat("\t", $depth);
    $output .= "
$indent<ul class=\"dropdown\">
";
  }
  function end_lvl(&$output, $depth) {
    $indent = str_repeat("\t", $depth);
    $output .= "$indent</ul>
";
  }
}