<?php
/**
 * Displays top navigation
 *
 * @package Cooking Food Blogger
 */
?>

<div class="header-navigation">
    <div class="container">
        <div class="header-navigation-inner">
            <div class="row">
                <div class="col-xl-3 col-lg-3 col-md-4 col-12 align-self-center text-center text-md-start">
                    <div class="navbar-brand">
                        <?php if ( has_custom_logo() ) : ?>
                        <div class="site-logo"><?php the_custom_logo(); ?></div>
                    <?php endif; ?>
                    <?php $cooking_food_blogger_blog_info = get_bloginfo( 'name' ); ?>
                        <?php if ( ! empty( $cooking_food_blogger_blog_info ) ) : ?>
                            <?php if ( is_front_page() && is_home() ) : ?>
                              <?php if( get_theme_mod('cooking_food_blogger_logo_title_text',true) != ''){ ?>
                                <h1 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1>
                              <?php } ?>
                            <?php else : ?>
                              <?php if( get_theme_mod('cooking_food_blogger_logo_title_text',true) != ''){ ?>
                                <p class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></p>
                              <?php } ?>
                            <?php endif; ?>
                        <?php endif; ?>
                        <?php
                            $cooking_food_blogger_description = get_bloginfo( 'description', 'display' );
                            if ( $cooking_food_blogger_description || is_customize_preview() ) :
                        ?>
                        <?php if( get_theme_mod('cooking_food_blogger_theme_description',false) != ''){ ?>
                            <p class="site-description"><?php echo esc_html($cooking_food_blogger_description); ?></p>
                        <?php } ?>
                    <?php endif; ?>
                    </div>
                </div>
                <div class="col-lg-7 col-md-4 col-4 align-self-center">
                    <div class="navigation_header py-2">
                        <div class="toggle-nav mobile-menu">
                            <button onclick="cooking_food_blogger_openNav()"><i class="fas fa-th"></i></button>
                        </div>
                        <div id="mySidenav" class="nav sidenav">
                            <nav id="site-navigation" class="main-navigation navbar navbar-expand-xl" aria-label="<?php esc_attr_e( 'Top Menu', 'cooking-food-blogger' ); ?>">
                                <?php {
                                    wp_nav_menu(
                                        array(
                                            'theme_location' => 'primary',
                                            'menu_class'     => 'menu', 
                                            'items_wrap'     => '<ul id="%1$s" class="%2$s">%3$s</ul>',
                                            'fallback_cb' => 'wp_page_menu',
                                        )
                                    );
                                } ?>
                            </nav>
                            <a href="javascript:void(0)" class="closebtn mobile-menu" onclick="cooking_food_blogger_closeNav()"><i class="fas fa-times"></i></a>
                        </div>
                    </div>
                </div>
                <div class="col-lg-1 col-md-2 col-4 align-self-center">
                    <?php if(get_theme_mod('cooking_food_blogger_search_setting',false) != ''){ ?>
                        <span class="head-search">
                            <div class="header-search-wrapper">
                                <span class="search-main">
                                    <i class="fa fa-search"></i>
                                </span>
                                <div class="search-form-main clearfix">
                                    <form method="get" class="search-form">
                                      <label>
                                        <input type="search" class="search-field form-control" placeholder="Search …" value="" name="s">
                                      </label>
                                      <input type="submit" class="search-submit btn btn-primary mt-3" value="Search">
                                    </form>
                                </div>
                            </div>
                        </span>
                    <?php }?>
                </div>
                <div class="col-lg-1 col-md-2 col-4 align-self-center text-center text-md-end">
                    <div class="slider-box-btn">
                        <?php if(get_theme_mod('cooking_food_blogger_button_text') != '' || get_theme_mod('cooking_food_blogger_button_link') != '' ){ ?>
                            <a href="<?php echo esc_url(get_theme_mod('cooking_food_blogger_button_link','')); ?>" class="mb-0"><?php echo esc_html(get_theme_mod('cooking_food_blogger_button_text','')); ?></a>
                        <?php }?>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>