I have a project which I should finish until tomorrow but I have a problem.
When I resize the browser(samller), primary-menu disappears and appears an empty element with a name nav-toggle. Even when I removed that nav-toggle, the primary menu is not displayable.

this is my php code

<div class="header-wrapper">

        <div class="header">

            <div class="section-inner">

                <?php if ( get_theme_mod( 'rowling_logo' ) ) : ?>

                    <a class="blog-logo" href='<?php echo esc_url( home_url('/') ); ?>' title='<?php echo esc_attr( get_bloginfo( 'title' ) ); ?> &mdash; <?php echo esc_attr( get_bloginfo( 'description' ) ); ?>' rel='home'>
                        <img src='<?php echo esc_url( get_theme_mod( 'rowling_logo' ) ); ?>' alt='<?php echo esc_attr( get_bloginfo( 'title' ) ); ?>'>
                    </a>

                <?php elseif ( get_bloginfo( 'description' ) || get_bloginfo( 'title' ) ) : ?>

                    <h2 class="blog-title">
                        <a href="<?php echo esc_url( home_url('/') ); ?>" title="<?php echo esc_attr( get_bloginfo( 'title' ) ); ?> &mdash; <?php echo esc_attr( get_bloginfo( 'description' ) ); ?>" rel="home"><?php echo esc_attr( get_bloginfo( 'title' ) ); ?></a>
                    </h2>

                    <?php if ( get_bloginfo( 'description' ) ) : ?>

                        <h4 class="blog-description">
                            <?php bloginfo('description'); ?>
                        </h4>

                    <?php endif; ?>

                <?php endif; ?>

                <div class="nav-toggle">

                    <div class="bars">

                        <div class="bar"></div>
                        <div class="bar"></div>
                        <div class="bar"></div>
                    </div>

                </div> <!-- /nav-toggle -->

            </div> <!-- /section-inner -->

        </div> <!-- /header -->

        <div class="navigation">

            <div class="section-inner">

                <ul class="primary-menu">

                    <?php if ( has_nav_menu( 'primary' ) ) {

                        wp_nav_menu( array( 

                            'container' => '', 
                            'items_wrap' => '%3$s',
                            'theme_location' => 'primary'

                        ) ); } else {

                        wp_list_categories( array(

                            'container' => '',
                            'title_li' => ''

                        ));
                        wp_list_pages( array(

                            'container' => '',
                            'title_li' => ''

                        ));
                    } ?>

                </ul>

                <div class="clear"></div>

            </div>

        </div> <!-- /navigation -->

        <ul class="mobile-menu">

            <?php 

            ?>

        </ul> <!-- /mobile-menu -->

    </div> <!-- /header-wrapper -->

this is some css code for primary-menu class

.primary-menu { display: none; }

.primary-menu ul ul { 
padding-top: 0;
top: 10px;
}

.primary-menu ul ul li { background: #333; }
.primary-menu ul ul .menu-item-has-children:hover::after { border-left-
 color:  #333; }
.primary-menu ul ul ul li { background: #444; }
.primary-menu ul ul ul .menu-item-has-children:hover::after { border-left-
color: #444; }
.primary-menu ul ul ul ul li { background: #555; }
.primary-menu ul ul ul ul .menu-item-has-children:hover::after { border-
left- color: #555; }
.primary-menu ul ul ul ul ul li { background: #666; }
.primary-menu ul ul ul ul ul .menu-item-has-children:hover::after { border-
left-color: #666; }

.primary-menu li > ul > li:hover > ul {
opacity: 1;
top: 0;
left: 220px;
margin-left: 0;
}

.navigation .section-inner { background-color: #C0C0C0; }


.primary-menu { font-size: 0.8rem; }

.primary-menu > li { 
float: left; 
border-right: 1px solid rgba(0,0,0,0.1);
border-left: 1px solid rgba(255,255,255,0.1);
}

.primary-menu > li:last-child:after {
content: "";
display: block;
border-right: 1px solid rgba(255,255,255,0.1);
position: absolute;
top: 0;
right: -2px;
bottom: 0;
}

.primary-menu > li > a {
display: block;
padding: 20px;
font-weight: 900;
text-transform: uppercase;
letter-spacing: 1px;
color: #fff;
text-shadow: 0 1px 0 rgba(0,0,0,0.25);
}

.primary-menu > li.menu-item-has-children > a { padding-right: 34px; }

.primary-menu > li.menu-item-has-children:before,
.primary-menu > li.menu-item-has-children:after {
content: "";
display: block;
border: 4px solid transparent;
border-top-color: #fff;
position: absolute;
top: 50%;
margin-top: -3px;
right: 20px;
}

.primary-menu > li.menu-item-has-children:before {
border-top-color: rgba(0,0,0,0.25);
margin-top: -2px;
}

.primary-menu > li:hover > a {
background: rgba(255,255,255,0.1);
color: #fff;
}

.primary-menu > li.current_menu_item > a { 
background: #fff; 
border: none; 
color: #333;
}

Please anybody can help me how should I do if I want to show the menu even the browser is resized?

Read more here: how to show a menu when the browser is resized?(wordpress)


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: