\n";
}
}
/**
* Starts the element output.
*
* @since 3.0.0
* @since 4.4.0 The {@see 'nav_menu_item_args'} filter was added.
*
* @see Walker::start_el()
*
* @param string $output Used to append additional content (passed by reference).
* @param WP_Post $item Menu item data object.
* @param int $depth Depth of menu item. Used for padding.
* @param stdClass $args An object of wp_nav_menu() arguments.
* @param int $id Current item ID.
*/
public function start_el( &$output, $item, $depth = 0, $args = null, $id = 0 ) {
$args = (object) $args;
global $wp_query;
$indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';
// Set some vars
if ( $depth === 0 ) {
$this->megamenu = get_post_meta( $item->ID, '_menu_item_megamenu', true );
$this->megamenu_auto_width = get_post_meta( $item->ID, '_menu_item_megamenu_auto_width', true );
$this->megamenu_col = get_post_meta( $item->ID, '_menu_item_megamenu_col', true );
$this->megamenu_heading = get_post_meta( $item->ID, '_menu_item_megamenu_heading', true );
}
// Set up empty variable.
$class_names = '';
$classes = empty( $item->classes ) ? array() : (array) $item->classes;
$classes[] = 'menu-item-' . $item->ID;
// Mega menu and Hide headings
if ( $depth === 0 && $this->has_children && 'vertical' != oceanwp_header_style() ) {
if ( $this->megamenu != '' && $this->megamenu_auto_width == '' ) {
$classes[] = 'megamenu-li full-mega';
} elseif ( $this->megamenu != '' && $this->megamenu_auto_width != '' ) {
$classes[] = 'megamenu-li auto-mega';
}
if ( $this->megamenu != '' && $this->megamenu_heading != '' ) {
$classes[] = 'hide-headings';
}
}
// Latest post for menu item categories
if ( $item->category_post != '' && $item->object == 'category' && 'vertical' != oceanwp_header_style() ) {
$classes[] = 'menu-item-has-children megamenu-li full-mega mega-cat';
}
// Nav no click
if ( $item->nolink != '' ) {
$classes[] = 'nav-no-click';
}
/**
* Filters the arguments for a single nav menu item.
*
* @since 4.4.0
*
* @param stdClass $args An object of wp_nav_menu() arguments.
* @param WP_Post $item Menu item data object.
* @param int $depth Depth of menu item. Used for padding.
*/
$args = apply_filters( 'nav_menu_item_args', $args, $item, $depth );
/**
* Filters the CSS class(es) applied to a menu item's list item element.
*
* @since 3.0.0
* @since 4.1.0 The `$depth` parameter was added.
*
* @param array $classes The CSS classes that are applied to the menu item's `
` element.
* @param WP_Post $item The current menu item.
* @param stdClass $args An object of wp_nav_menu() arguments.
* @param int $depth Depth of menu item. Used for padding.
*/
$class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item, $args, $depth ) );
$class_names = $class_names ? ' class="' . esc_attr( $class_names ) . '"' : '';
/**
* Filters the ID applied to a menu item's list item element.
*
* @since 3.0.1
* @since 4.1.0 The `$depth` parameter was added.
*
* @param string $menu_id The ID that is applied to the menu item's `
` element.
* @param WP_Post $item The current menu item.
* @param stdClass $args An object of wp_nav_menu() arguments.
* @param int $depth Depth of menu item. Used for padding.
*/
$id = apply_filters( 'nav_menu_item_id', 'menu-item-' . $item->ID, $item, $args, $depth );
$id = $id ? ' id="' . esc_attr( $id ) . '"' : '';
$output .= $indent . '
` for a menu item.
*
* @since 3.0.0
*
* @param string $item_output The menu item's starting HTML output.
* @param WP_Post $item Menu item data object.
* @param int $depth Depth of menu item. Used for padding.
* @param stdClass $args An object of wp_nav_menu() arguments.
*/
$output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );
}
/**
* Ends the element output, if needed.
*
* @since 3.0.0
*
* @see Walker::end_el()
*
* @param string $output Used to append additional content (passed by reference).
* @param WP_Post $item Page data object. Not used.
* @param int $depth Depth of page. Not Used.
* @param stdClass $args An object of wp_nav_menu() arguments.
*/
public function end_el( &$output, $item, $depth = 0, $args = null ) {
// Header style
$header_style = oceanwp_header_style();
if ( $depth === 0 && $item->category_post != ''
&& 'full_screen' != $header_style && 'vertical' != $header_style ) {
global $post;
$output .= "\n
output.
$output .= '';
}
/**
* Ends the list of after the elements are added.
*
* @since 3.0.0
*
* @see Walker::end_lvl()
*
* @param string $output Used to append additional content (passed by reference).
* @param int $depth Depth of menu item. Used for padding.
* @param stdClass $args An object of wp_nav_menu() arguments.
*/
public function end_lvl( &$output, $depth = 0, $args = null ) {
$indent = str_repeat( "\t", $depth );
$output .= "$indent