需要在wordpress中使用ajax菜单的帮助。此时,菜单成功地在当前菜单项中添加了css类标签'active‘。
我需要将它从<a>移到父<li>...
有什么想法吗?
    <?php 
            $section_number = 0;
            $first_social_type = '';
            echo '<ul class="current-nav0" id="main-navigation" >';
            if( !empty( $gdl_menu_node ) ){
                foreach( $gdl_menu_node->childNodes as $menu_item ){
                    $active = ''; 
                    if( $section_number == 0){
                        $active = " active";
                        $first_social_tye = (find_xml_value($menu_item, 'icon-type') == 'light')? ' light':'';
                    }
                    echo '<li><a href="' . $gdl_is_home_url . '#section-n' . $section_number . '" id="nav-section' . $section_number . '" class="anchor' . $active . $gdl_is_home_class . '" >';
                    echo __(find_xml_value($menu_item, 'menu-name'), 'gdl_front_end');
                    echo '</a></li>';
                    $section_number++;
                }
            }
        ?>发布于 2012-12-17 23:29:17
尝试更改此行:
echo '<li><a href="' . $gdl_is_home_url . '#section-n' . $section_number . '" id="nav-section' . $section_number . '" class="anchor' . $active . $gdl_is_home_class . '" >';至:
echo '<li  class="' . $active . '"><a href="' . $gdl_is_home_url . '#section-n' . $section_number . '" id="nav-section' . $section_number . '" class="anchor' . $gdl_is_home_class . '" >';https://stackoverflow.com/questions/13916990
复制相似问题