简体   繁体   中英

my Css code for navigation menu not working in Wordpress theme

while making my custom navigation menus for my own Worpress theme, navigation menu's css code's some codes are working, some are not working while entering php navigation code for Wordpress theme.

This my php code for wordpress navigation menu

    <?php   wp_nav_menu( array(
                                'theme_location'    => 'primary',
                                'depth'              => 2,
                                'container'         => 'ul',
                                'container_class'   => '',
                                'menu_class'        => 'nav-link',
                                'fallback_cb'       => 'WP_Bootstrap_Navwalker::fallback',
                                'walker'            => new WP_Bootstrap_Navwalker())
                                 );?>

so i am having so many classes in navigation menu so my css code is very long that's why i am adding my html code for my navigiation bar. this my html code for navigation menu.

<ul>
                 <li class="nav-link" style="--i: .6s">
                       <a href="/home.php">Home</a>
                   </li>
                   <li class="nav-link" style="--i: .85s" >
                       <a href="#">Categories<i class="fas fa-caret-down"></i></a>
                       <div class="dropdown ">
   
                           <ul> 
                               <li class="dropdown-link">
                                   <a href="/pages/motivation.php">Motivation</a>
                               </li>
                               <li class="dropdown-link">
                                   <a href="/pages/health.php">Health</a>
                               </li>
                               <li class="dropdown-link">                    
                               <a class=" href="/pages/science&tech.php">Science & Technology</a>
                                            
                               </li>
                               <li class="dropdown-link">
                                   <a href='/pages/finance.php'>Finance</a>
                               </li>
                               <li class="dropdown-link">
                                   <a href="/pages/random.php">Random</a>
                               </li>
                               <div class="arrow"></div>
                           </ul>
                       </div>
                   </li>
                   <li class="nav-link" style="--i: 1.1s">
                       <a href="#">Archives<i class="fas fa-caret-down"></i></a>
                       <div class="dropdown">`enter code here`enter code here`
                           <ul>
                               <li class="dropdown-link">
                                   <a href="/pages/contact.php">Contact us</a>
                               </li>`enter code here`
                               <li class="dropdown-link">
                                   <a href="/pages/privacypolicy.php">Privacy Policy</a>
                               </li>
                               <li class="dropdown-link">
                                   <a href="/pages/terms&andcondition.php">Terms & Condition</a>
                                   
                               </li>
                               <li class="dropdown-link">
                                   <a href="/pages/disclaimer.php">Disclaimer</a>
                               </li>
                               <div class="arrow"></div>
                           </ul>
                       </div>
                   </li>
                   <li class="nav-link" style="--i: 1.35s">
                       <a href="/pages/about us.php">About</a>
                   </li>
               </ul>   

something wrong in my php code. can you give correct code for my navigation bar.

We don't see you code in context, but your 'container' element has wrong. You must set a nav or div , not ul (i suggest nav tag). Remember define 'container_class' too.

Then you must define your CSS rules including your container_class in spreadsheet. If is necessary, you must use !important .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM