【发布时间】:2013-06-19 19:36:10
【问题描述】:
我使用高级自定义字段插件,该插件非常适合向帖子或类别添加其他字段,但我找不到向 get_categories 函数添加参数的解决方案。
我想显示一个包含 child_of=X 的类别列表,并且特定的自定义字段必须等于 Y,但我的代码显示了所有的子项...
foreach(get_categories('child_of=4') as $category) {
// Get the icon in a variable
$my_icon = get_cat_icon('echo=false&cat='.$category->cat_ID);
// Display a list with icons and the category names
$value = get_field('ligue');
// Get value of ligue
if ($value == 1) {
echo '<div class="contentmenupage"><a href="'.get_category_link($category->cat_ID).'">'.$my_icon.'</a><br> <a href="'.get_category_link($category->cat_ID).'" title="'.$category->description.'">'.$category->cat_name.'</a><p>'.get_field('fondation', 'category_' . $category->cat_ID ).'<br>'.get_field('stade', 'category_' . $category->cat_ID ).'<br>'.get_field('couleurs', 'category_' . $category->cat_ID ).'<p></div>';
}
}
非常感谢您的帮助!
【问题讨论】: