php - 如何修复不显示列表的自定义分类中所有术语的 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>
解决方案
推荐阅读
- java - Android:从头开始改造现有项目
- mysql - SQL 左连接返回 NULL 值
- javascript - 如何在 MySQL 数据库中实现这种自动增量
- vue.js - Vue.js vee-validate 至少需要取消选中一个复选框
- java - 如何动态指定 Java 泛型类
- windows - 如何覆盖文件但保留原始文件时间戳
- javascript - 一些图像没有出现在我的 ionic 3 列表中
- python - Python甚至分组分配
- java - 来自 URL json 的 JavaFX Dynamic TableView
- android - CollapsingToolbarLayout 滚动时将自定义文本移动到中心