}
function start_el( &$output, $object, $depth = 0, $args = array(), $current_object_id = 0 ) {
+ static $saveParent = 0;
$item_html = '';
parent::start_el( $item_html, $object, $depth, $args );
+ //echo '<pre>$object: ' . print_r($object, true) . '</pre>';
// Insert style to display page's thumbnail
$item_style = '';
- if ($depth == 0 && has_post_thumbnail((int)$object->object_id)) {
- $thumbnail = wp_get_attachment_image_src(get_post_thumbnail_id((int)$object->object_id), 'large');
- $item_style .= "<style>#menu-item-".$object->ID." > .dropdown:before { background-image: url('".$thumbnail[0]."');</style>";
+ if ( $depth == 0 ) {
+ $saveParent = $object;
+ }
+ if ( $depth != 0 ) {
+ // get the page title from parent
+ $title = get_the_title( $saveParent->object_id );
+ $output .= '<li><h1>' . $title . '</h1></li>';
}
//$output .= ( 0 == $depth ) ? '<li class="divider"></li>' : '';
$classes = empty( $object->classes ) ? array() : (array) $object->classes;
if ( in_array( 'divider', $classes ) ) {
$item_html = preg_replace( '/<a[^>]*>( .* )<\/a>/iU', '', $item_html );
}
- if ($item_style)
+ if ($item_style) {
$output .= $item_style;
+ }
$output .= $item_html;
}