classes ) ? array() : (array) $item->classes;
//Getting post id of current page
//$postid = url_to_postid( $item->url );
//$have_children var keeps record of the children of the current page
$have_children = false;
$children = get_posts(array('post_type' => 'nav_menu_item', 'nopaging' => true, 'numberposts' => 1, 'meta_key' => '_menu_item_menu_item_parent', 'meta_value' => $item->ID));
if ( !empty( $children ) )
{
$have_children = true;
}
//If the current page has a child
if ( $have_children ) {
$classes[] = 'has-child menu-item-' . $item->ID;
} else {
$classes[] = 'menu-item-' . $item->ID;
}
$class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item, $args, $depth ) );
$class_names = $class_names ? ' class="' . esc_attr( $class_names ) . '"' : '';
$id = apply_filters( 'nav_menu_item_id', 'menu-item-' . $item->ID, $item, $args, $depth );
$id = $id ? ' id="' . esc_attr( $id ) . '"' : '';
$output .= $indent . '
';
$atts = array();
$atts['title'] = ! empty( $item->attr_title ) ? $item->attr_title : '';
$atts['target'] = ! empty( $item->target ) ? $item->target : '';
$atts['rel'] = ! empty( $item->xfn ) ? $item->xfn : '';
$atts['href'] = ! empty( $item->url ) ? $item->url : '';
$atts = apply_filters( 'nav_menu_link_attributes', $atts, $item, $args, $depth );
$page_name = apply_filters( 'the_title', $item->title, $item->ID );
$attributes = '';
foreach ( $atts as $attr => $value )
{
if ( ! empty( $value ) )
{
$value = ( 'href' === $attr ) ? esc_url( $value ) : esc_attr( $value );
$attributes .= ' ' . $attr . '="' . $value . '"';
}
}
//fontawesome icons
$right_arrow = ' ';
$down_arrow = ' ';
/* -End of changes- */
$item_output = $args->before;
$item_output .= '';
/** This filter is documented in wp-includes/post-template.php */
/* changes- */
if( $have_children && 'Home' != $page_name )
{
// Right/Left Arrows
if ( $depth > 0 )
{
$item_output .= $args->link_before . apply_filters( 'the_title', $item->title, $item->ID ) . $right_arrow . $args->link_after;
}
// Down Arrows
else
{
$item_output .= $args->link_before . apply_filters( 'the_title', $item->title, $item->ID ) . $down_arrow .$args->link_after;
}
}
else
{
$item_output .= $args->link_before . apply_filters( 'the_title', $item->title, $item->ID ) . $args->link_after;
}
/* -End of changes- */
$item_output .= '';
$item_output .= $args->after;
$output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );
}
public function end_el( &$output, $item, $depth = 0, $args = array() )
{
$output .= "\n";
}
}
}