<?php

/*/**
 * Class DropDown_Nav_Menu
 * This class defines the logic for the menu rendering.
 */


/*class Navthemes_Nav_Menu extends Walker_page {

    function start_el( &$output, $page, $depth=0, $args=array(), $current_page = 0 ) {

        $post = get_post($page->ID);
        $slug = $post->post_name;
        $output .= sprintf("\n<li class=\"page-scroll\"><a href=\"%s\">%s</a>",
            (is_front_page() ? '' : get_site_url().'/').($slug == 'blog' ? $slug : '#'.$slug),
            apply_filters( 'the_title', $page->post_title, $page->ID )
        );
    }
    public function end_el( &$output, $page, $depth=0, $args=array(),  $current_page = 0 ) {

        $output .= '</li>';

    }

}*/

/**
 * Class DropDown_Nav_Menu
 * This class defines the logic for the menu rendering.
 */

 class Navthemes_Nav_Menu extends Walker_Nav_Menu {


    public function display_element ($element, &$children_elements, $max_depth, $depth = 0, $args, &$output) {
        // check, whether there are children for the given ID and append it to the element with a (new) ID
        $element->hasChildren = isset($children_elements[$element->ID]) && !empty($children_elements[$element->ID]);

        return parent::display_element($element, $children_elements, $max_depth, $depth, $args, $output);
    }

    public function start_el(&$output, $item, $depth=0, $args=array(), $current_object_id = 0) {

        $output .= sprintf("\n<li><a href=\"%s\" itemprop='url'><span itemprop='name'> %s </span></a>",
            $item->url,
            $item->title
        );

    }

    public function end_el(&$output, $item, $depth=0, $args=array(), $current_object_id = 0) {

        $output .= '</li>';

    }

}
 