如何在WordPress的NAV中添加ul和li类

时间:2017-09-23 作者:Sathyababuram

我在html引导程序中有这个部分。我想转换为Wordpress导航。

<section class="mbr-navbar mbr-navbar--freeze mbr-navbar--absolute mbr-
    navbar--transparent mbr-navbar--sticky mbr-navbar--auto-collapse" id="menu-
     74">
    <div class="mbr-navbar__section mbr-section">
        <div class="mbr-section__container container">
            <div class="mbr-navbar__container">
                <div class="mbr-navbar__column mbr-navbar__column--m mbr-navbar__brand">
                   <!-- <span class="mbr-navbar__brand-link mbr-brand mbr-brand--inline">
                        <span class="mbr-brand__logo"><a href="#"><img class="mbr-navbar__brand-img mbr-brand__img" src="assets/images/discover-mobile-350x350-53.png" alt="Comp service"></a></span>-->
                        <span class="mbr-brand__name"><a class="mbr-brand__name text-another" href="#"><?php  bloginfo(\'name\'); ?></a></span>
                    </span>
                </div>
                <div class="mbr-navbar__hamburger mbr-hamburger text-white"><span class="mbr-hamburger__line"></span></div>

                <div class="mbr-navbar__column mbr-navbar__menu">
                    <nav class="mbr-navbar__menu-box mbr-navbar__menu-box--inline-right">
                        <div class="mbr-navbar__column">
                            <ul class="mbr-navbar__items mbr-navbar__items--right mbr-buttons mbr-buttons--freeze mbr-buttons--right btn-decorator mbr-buttons--active">
                                <li class="mbr-navbar__item"><a class="mbr-buttons__link btn text-another" href="#menu-74">Home</a></li>
                                <li class="mbr-navbar__item"><a class="mbr-buttons__link btn text-another" href="#features1-75">About us</a></li>
                                <li class="mbr-navbar__item"><a class="mbr-buttons__link btn text-another" href="#msg-box3-81">HP OFFICEJET</a></li>
                                <li class="mbr-navbar__item"><a class="mbr-buttons__link btn text-another" href="#pricing-table1-86">HP ENVY</a></li>
                                <li class="mbr-navbar__item"><a class="mbr-buttons__link btn text-another" href="#testimonials1-88">HP DESKJET</a></li>
                                <li class="mbr-navbar__item"><a class="mbr-buttons__link btn text-another" href="#form1-89">HP LASERJET</a></li>
                                 <li class="mbr-navbar__item"><a class="mbr-buttons__link btn text-another" href="#form1-89">Contact Us</a></li>
                            </ul></div>
                    </nav>
                </div>
            </div>
        </div>
    </div>
</section>
有人能帮我摆脱这一切吗?

1 个回复
SO网友:Marcelo Henriques Cortez

如果您使用的是Bootstrap 3.0+,则可以按照以下步骤操作:https://github.com/wp-bootstrap/wp-bootstrap-navwalker

您可以访问的另一个参考链接是:https://code.tutsplus.com/tutorials/how-to-integrate-a-bootstrap-navbar-into-a-wordpress-theme--wp-33410

通常,当你有一个HTML菜单(不是说特定于引导程序)时,最好只生成常规的WordPress菜单,而不是在原来的菜单上应用你的样式。

结束

相关推荐

Problem with custom menus

在菜单上,我说的是自定义菜单,我有一个带有几列的页脚,每列都有一个项目列表,每列菜单都需要从wp admin上的菜单选项进行更新,所以我创建了关于函数的部分。调用菜单并在页脚上添加每个菜单的php。php文档,类似于:<?php wp_nav_menu( array(\'menu\' => \'f-1\', \'menu_class\' => \'\', \'container\' => \'nav\' )); ?> <?php wp_nav_menu( arr