classes ) ? array() : (array) $item->classes;
$class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item ) );
$class_names = ' class="'. esc_attr( $class_names ) . '"';
$output .= $indent . '
' . $link_before . $title . $link_after . '';
if ( !empty($show_date) ) {
if ( 'modified' == $show_date )
$time = $page->post_modified;
else
$time = $page->post_date;
$output .= " " . mysql2date($date_format, $time);
}
$output = apply_filters( 'graphene_page_description_walker_output', $output, $page, $depth, $args, $current_page );
}
}
/*
* Adds a menu-item-ancestor class to menu items with children when using custom menu
*
* @package Graphene
* @since Graphene 1.8
*/
function graphene_menu_item_ancestor( $items ) {
foreach ( $items as $item ) {
if ( graphene_menu_has_sub( $item->ID, $items ) ) {
$item->classes[] = 'menu-item-ancestor';
}
}
return $items;
}
add_filter( 'wp_nav_menu_objects', 'graphene_menu_item_ancestor' );
/**
* Check if a Custom Menu menu item has sub-menu item
*
* @package Graphene
* @since Graphene 1.8
*/
function graphene_menu_has_sub( $menu_item_id, &$items ) {
foreach ( $items as $item ) {
if ( $item->menu_item_parent && $item->menu_item_parent==$menu_item_id ) {
return true;
}
}
return false;
};
/*
* Adds a menu-item-ancestor class to menu items with children when using default menu
*
* @package Graphene
* @since Graphene 1.8
*/
function graphene_page_ancestor_class( $css_class, $page, $depth, $args ) {
if ( ! empty( $args['has_children'] ) )
$css_class[] = 'menu-item-ancestor';
if ( array_search( 'current_page_ancestor', $css_class ) ) $css_class[] = 'current-menu-ancestor';
if ( array_search( 'current_page_parent', $css_class ) ) $css_class[] = 'current-menu-ancestor';
if ( array_search( 'current_page_item', $css_class ) ) $css_class[] = 'current-menu-item';
return $css_class;
}
add_filter( 'page_css_class', 'graphene_page_ancestor_class', 10, 4 );
/**
* Add additional navigation menu class
*/
function graphene_get_menu_class( $menu_class ){
global $graphene_settings;
// if the search box is located in the navigation bar restrict the width of the menu to 12 grid columns
if ( ( $search_box_location = $graphene_settings['search_box_location']) && $search_box_location == 'nav_bar' ){
$menu_class .= ' grid_12';
}
return apply_filters( 'graphene_menu_class', $menu_class );
}