<?php
/**
 * Name:  Header style 11
 **/
?>
<header id="header" class="header style-11">
    <div class="header-top">
        <div class="logo"><?php ocolus_get_logo(); ?></div>
        <div class="header-control">
			<?php
			if ( function_exists( 'ocolus_header_mini_cart' ) ) ocolus_header_mini_cart();
			ocolus_user_link();
			ocolus_header_search( 'style-02' );
			?>
            <div class="mobile-block block-menu-bar">
                <a href="javascript:void(0)" class="menu-bar menu-toggle">
                    <span class="icon"><span></span><span></span><span></span></span>
                </a>
            </div>
			<?php ocolus_get_header_menu( 'header_top_menu' ); ?>
        </div>
    </div>
	<?php
	$count      = 0;
	$items      = 5;
	$text       = esc_html__( 'MORE', 'ocolus' );
	$locations  = get_nav_menu_locations();
	$menu_id    = $locations['primary'];
	$menu_items = wp_get_nav_menu_items( $menu_id );
	foreach ( $menu_items as $menu_item ) {
		if ( $menu_item->menu_item_parent == 0 ) {
			$count++;
		}
	}
	?>
    <div class="header-bot">
        <div class="header-inner megamenu-wrap">
            <div class="box-header-nav"
                 data-items="<?php echo esc_attr( $items ); ?>">
				<?php
				if ( has_nav_menu( 'primary' ) ) {
					wp_nav_menu( array(
							'menu'            => 'primary',
							'theme_location'  => 'primary',
							'depth'           => 3,
							'container'       => '',
							'container_class' => '',
							'container_id'    => '',
							'menu_class'      => 'main-menu',
                            'megamenu_layout' => 'vertical',
						)
					);
					if ( $count > $items ): ?>
                        <div class="view-all-category">
                            <a href="#" data-closetext="<?php echo esc_html__( 'LESS', 'ocolus' ); ?>"
                               data-alltext="<?php echo esc_html( $text ); ?>"
                               class="btn-view-all open-cate">
                                <span class="icon"><span></span><span></span><span></span></span>
                                <span class="text"><?php echo esc_html( $text ); ?></span>
                            </a>
                        </div>
					<?php endif;
				}
				?>
            </div>
        </div>
    </div>
</header>