How do I add the tertiary level from the main menu to my skin? Let's say I have the following menu:


Smartphones

Android

LG Nexus 4
Samsung Galaxy Note 2
HTC One
Motorola Droid RAZR MAXX HD

iOS

iPhone 4
iPhone 4S
iPhone 5

Windows Phone

HTC Windows Phone 8X
HTC Windows Phone 8S
Nokia Lumia 920
Nokia Lumia 820




I want a menu that will display all the third level items if I'm on the parent node.  So, if I'm on the Android page, I should see LG Nexus 4, Samsung Galaxy Note 2, HTC One, and Motorola Droid RAZR MAXX HD.

The only recommendation I keep seeing is to use the Menu block module, but I want to just create the menu myself in PHP.  How?
I figured it out.  In template.php, I added the following function:

function MYTHEME_preprocess_page(&amp;$variables) {
    $active_tree = menu_get_active_trail();
    $parent = array_pop($active_tree);
    if($parent['depth'] == 3) {
        $parent = array_pop($active_tree);
    }

    $parameters = array(
        'active_trail' =&gt; array($parent['plid']),
        'only_active_trail' =&gt; FALSE,
        'min_depth' =&gt; 3,
        'max_depth' =&gt; 3,
        'conditions' =&gt; array('plid' =&gt; $parent['mlid']),
      );

    $tertiary_menu = menu_build_tree($parent['menu_name'], $parameters);

    $links = array();
    foreach($tertiary_menu as $branch=&gt;$link) {
        array_push($links, $link['link']);
    }

    $tertiary_links_vars = array(
        'links' =&gt; $links,
        'attributes' =&gt; array('class' =&gt; array('sub-nav')),
        'heading' =&gt; array(
            'text' =&gt; t('Tertiary menu'),
            'level' =&gt; 'h2',
            'class' =&gt; array('element-invisible'),
        ),
    );

    $variables['tertiary_menu'] = theme_links($tertiary_links_vars);
}


In my page.tpl.php file, I added the following:

&lt;?php print $tertiary_menu; ?&gt;