首页 > 解决方案 > 如何修复不显示列表的自定义分类中所有术语的 Wordpress 下拉菜单?

问题描述

我正在尝试解决在此项目中发现的问题:http: //farmaciassaopaulo-com.umbler.net/

横幅下方是“类别”和“标签”按钮,应该列出自定义 wordpress 类别。

但是下拉菜单不显示列表。

使用浏览器控制台,我们可以看到列表,但是对于一些编码失败,我无法弄清楚错误来自哪里。

任何 Wordpress 专家可以指导我吗?

此致。

<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">CATEGORIAS
    <span class="caret"></span>
</a>

<ul class="dropdown-menu" style="width: 100%;">                                     
    <?php                                           
        $args = array('parent' => 0);
        $terms = get_terms('categorias', $args);
        foreach( $terms as $term ):
        $children = get_terms( 'categorias', array('parent' => $term->term_id));
    ?>

        <li class="lista-categoria font-museo-sans-300 dropdown-submenu">

            <a href="<?php echo get_category_link( $term->term_id ) ?>">
                <?php echo $term->name; ?>
                <?php if ($children) { ?>
                <span class="caret-right"></span>
                <?php } ?>
            </a>

            <?php if ($children) { ?>

            <ul class="dropdown-menu">
                <?php foreach( $children as $childrens ): ?>

            <li>
                <a tabindex="-1" href="<?php echo get_category_link( $childrens->term_id ) ?>">
                    <?php echo $childrens->name;?>
                </a>
            </li>                                                   

            <?php endforeach; ?>
        </ul>

            <?php } ?>                                              

        </li>
    <?php endforeach; ?>
</ul>
</li>

标签: phphtmlcsswordpress

解决方案


推荐阅读