is_custom_width ) ? ' style="width: '. $this->is_custom_width .'px"' : '';
$indent = str_repeat( "\t", $depth );
$output .= "\n$indent
\n";
}
function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) {
$class_names = '';
$value = '';
$indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';
$classes = empty( $item->classes ) ? array() : $item->classes;
$classes[] = 'menu-item-' . $item->ID;
// adding depth class
$classes[] = 'rox-depth-'. $depth;
// adding if mega menu class
$classes[] = ( $depth == 0 && ! empty( $item->mega ) ) ? 'rox-mega-menu' : '';
// adding if natural-width class
$classes[] = ( $depth == 0 && ! empty( $item->mega ) && $item->mega_width == 'natural' ) ? 'rox-col-'.$this->child_count . ' rox-'. $item->mega_width : '';
// adding if custom-width class
$classes[] = ( $depth == 0 && ! empty( $item->mega ) && $item->mega_width == 'custom' ) ? 'rox-'. $item->mega_width : '';
// adding if right position class
$classes[] = ( $depth == 0 && ! empty( $item->mega ) && ! empty( $item->mega_width ) && ! empty( $item->mega_position ) ) ? 'rox-right' : '';
// adding bootstrap col if parent item is mega!
// if( $depth == 1 && isset( $this->menu_type[$item->menu_item_parent] ) ) {
// $bs_col = ( ! rox_get_option( 'non_responsive' ) ) ? str_replace( 'md' , 'xs', rox_get_bootstrap( $this->child_count ) ) : rox_get_bootstrap( $this->child_count );
// }
$classes['col'] = ( ! empty( $bs_col ) ) ? $bs_col : '';
// adding force custom boostrap col
$classes['col'] = ( $depth == 1 && ! empty( $item->column_width ) ) ? $item->column_width : $classes['col'];
$class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item, $args ) );
$class_names = $class_names ? ' class="' . esc_attr( $class_names ) . '"' : '';
$id = apply_filters( 'nav_menu_item_id', 'menu-item-'. $item->ID, $item, $args );
$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 );
$attributes = '';
foreach ( $atts as $attr => $value ) {
if ( ! empty( $value ) ) {
$value = ( 'href' === $attr ) ? esc_url( $value ) : esc_attr( $value );
$attributes .= ' ' . $attr . '="' . $value . '"';
}
}
$item_output = $args->before;
// if column title not disable
if( empty( $item->column_title ) ) {
// if column title link not disable
if( empty( $item->column_title_link ) ) {
//$rox_hover_effect = rox_get_option( 'header_menu_effect' );
//$rox_hover_effect = ( $rox_hover_effect !== 'none' ) ? ' rox-hover rox-hover-effect-' . rox_get_option( 'header_menu_effect' ) : '';
$is_sticky_item = ( $depth == 0 ) ? ' rox-sticky-item' : '';
$is_mega_column = ( isset( $this->menu_type[$item->menu_item_parent] ) ) ? ' rox-title' : '';
$item_output .= '';
} else if( $depth == 1 && ! empty( $item->column_title_link ) ) {
$item_output .= ''. $item->colum_title;
}
// adding icon
$item_output .= ( ! empty( $item->icon ) ) ? '' : '';
$item_output .= $args->link_before . apply_filters( 'the_title', $item->title, $item->ID ) . $args->link_after;
if( ! empty( $item->highlight ) ){
$highlight = ( ! empty( $item->highlight_type ) ) ? $item->highlight_type : 'default';
$item_output .= ''. $item->highlight .'';
}
// adding custom content
$item_output .= ( ! empty( $item->content ) ) ? ''. do_shortcode( $item->content ) .'' : '';
// if column title link not disable
if( empty( $item->column_title_link ) || ( $depth == 1 && ! empty( $item->column_title_link ) ) ) {
$item_output .= '';
}
}
// adding force custom content
if( ! empty( $item->column_title ) ) {
$item_output .= ( ! empty( $item->content ) ) ? ''. do_shortcode( $item->content ) .'
' : '';
}
$item_output .= $args->after;
$output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );
}
function display_element($element, &$children_elements, $max_depth, $depth = 0, $args, &$output) {
if( !empty( $element->mega ) ) {
$this->child_count = ( isset( $children_elements[$element->ID] ) ) ? count( $children_elements[$element->ID] ) : 0;
$this->menu_type[$element->ID] = true;
}
if( $depth == 0 && !empty( $element->mega ) && $element->mega_width == 'custom' ) {
$this->is_custom_width = $element->mega_custom_width;
} else {
$this->is_custom_width = false;
}
parent::display_element($element, $children_elements, $max_depth, $depth, $args, $output);
}
public function custom_wrap(){
$output = '';
if( rox_get_option( 'menu_search' ) ){
$output .= '';
}
if( rox_get_option( 'woo_menu_cart' ) && is_woocommerce_activated() ){
$output .= '';
}
$output = apply_filters( 'rox_custom_menu_wrap', $output );
return '';
}
} // Walker_Nav_Menu
}
if( !class_exists('Walker_Nav_Menu_Edit_Custom') ){
class Walker_Nav_Menu_Edit_Custom extends Walker_Nav_Menu {
function start_lvl( &$output, $depth = 0, $args = array() ) {}
function end_lvl( &$output, $depth = 0, $args = array() ) {}
function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) {
global $_wp_nav_menu_max_depth;
$_wp_nav_menu_max_depth = $depth > $_wp_nav_menu_max_depth ? $depth : $_wp_nav_menu_max_depth;
ob_start();
$item_id = esc_attr( $item->ID );
$removed_args = array(
'action',
'customlink-tab',
'edit-menu-item',
'menu-item',
'page-tab',
'_wpnonce',
);
$original_title = '';
if ( 'taxonomy' == $item->type ) {
$original_title = get_term_field( 'name', $item->object_id, $item->object, 'raw' );
if ( is_wp_error( $original_title ) )
$original_title = false;
} elseif ( 'post_type' == $item->type ) {
$original_object = get_post( $item->object_id );
$original_title = get_the_title( $original_object->ID );
}
$classes = array(
'menu-item menu-item-depth-' . $depth,
'menu-item-' . esc_attr( $item->object ),
'menu-item-edit-' . ( ( isset( $_GET['edit-menu-item'] ) && $item_id == $_GET['edit-menu-item'] ) ? 'active' : 'inactive'),
);
$title = $item->title;
if ( ! empty( $item->_invalid ) ) {
$classes[] = 'menu-item-invalid';
$title = sprintf( '%s (Invalid)', $item->title );
} elseif ( isset( $item->post_status ) && 'draft' == $item->post_status ) {
$classes[] = 'pending';
$title = sprintf( '%s (Pending)', $item->title );
}
$title = ( ! isset( $item->label ) || '' == $item->label ) ? $title : $item->label;
$submenu_text = '';
if ( 0 == $depth )
$submenu_text = 'style="display: none;"';
?>