Esempio n. 1
0
    wp_nav_menu($args);
} else {
    $pages = get_posts(array('numberposts' => 7, 'post_type' => 'page', 'order' => 'ASC'));
    if (!empty($pages)) {
        echo '<div class="menu-list-wrapper">';
        echo '<ul class="mythemes-menu-list">';
        foreach ($pages as $p => $item) {
            $classes = '';
            $mythemes_curr_ancestor = false;
            if ($item->post_parent > 0) {
                continue;
            }
            if (is_page($item->ID) || $item->ID === absint(get_option('page_for_posts')) && is_home()) {
                $classes = 'current-menu-item';
            }
            $submenu = mythemes_tools::submenu($item->ID);
            if (!empty($submenu)) {
                $classes .= ' menu-item-has-children';
                if ($mythemes_curr_ancestor) {
                    $classes .= ' current-menu-ancestor';
                }
            }
            echo '<li class="menu-item ' . esc_attr($classes) . '">';
            echo '<a href="' . esc_url(get_permalink($item->ID)) . '" title="' . mythemes_tools::title($item->ID, true) . '">' . mythemes_tools::title($item->ID) . '</a>';
            echo $submenu;
            echo '</li>';
        }
        echo '</ul>';
        echo '</div>';
    }
}