2013-06-19 24 views
0

我使用高級自定義字段插件非常適合向帖子或類別添加額外字段,但是我找不到向get_categories函數添加參數的解決方案。Wordpress - 使用高級自定義字段參數查詢分類列表

我想顯示的是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>'; 
} 
} 

非常感謝您對你的幫助!

回答

相關問題