【问题标题】:Add a <div> around the ul of a wordpress dropdown在 wordpress 下拉列表的 ul 周围添加 <div>
【发布时间】:2014-05-22 21:30:45
【问题描述】:

在转换为 wordpress 之前的 HTML 中,我在 UL 元素周围有两个 div,但现在由于 wordpress 自动创建下拉导航,我需要定义它以在生成的周围添加这两个 div(以及第二个 div 的 CLASS) UL。

我已经包含了应该使用的导航的原始 HTML。

直播网站:http://bit.ly/1k90oaO

HTML

<ul class="nav">
<li class="active">
    <a href="/HTML/index.php" class="active">HOME</a>
</li>
<li>
    <a href="/parts.php">PARTS</a>
    <div>
        <div class="nav-column">
            <br />
            <ul class="full-width">
                <li class="nav-li-item"><a href="/HTML/parts.php">Beltings &amp; Tensioners</a></li>
                <li class="nav-li-item"><a href="/HTML/parts.php">Beltings &amp; Tensioners</a></li>
            </ul>
        </div>
    </div>
</li>
</ul>

wordpress 中的当前设置。 functions.php

add_theme_support( 'menus' );

function register_theme_menus() {

    register_nav_menus(
        array(
            'header-menu'   =>   __( 'Header Menu' )
        )
    );  
}
add_action( 'init', 'register_theme_menus' );

header.php

<?php
    $args = array(
        'menu'       => 'header-menu',
        'menu_class' => 'nav',
        'container'  => 'true',
    );
    wp_nav_menu( $args );
?>

【问题讨论】:

    标签: php html wordpress


    【解决方案1】:

    参见wp_nav_menu() in codex 的'items_wrap' 选项。

    【讨论】:

    • 我试过了,但它一直将
      包裹在每个 LI 元素周围,而不是一组 DIV 包裹整个 UL。
    猜你喜欢
    • 2012-05-06
    • 1970-01-01
    • 2020-12-01
    • 2011-08-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多