2012-07-06 66 views
2

我試圖打印一個類別的自定義字段,但沒有成功。高級自定義字段不打印類別

這是我的代碼:

 $args = array(
    'taxonomy' => 'gb_category', 
    'orderby' => 'name',          
    'style'  => 'list', 
    'hide_empty' => 0, 
); 

$categories = get_categories($args); 
$i = 1; 
foreach ($categories as $cat) { 

    the_field('category_custom_field'); 

} 

回答

7

解決。

如果您需要自定義的申請類別,那麼你用下面的代碼調用:

<?php the_field('starting_from', 'category_'.$cat->cat_ID); ?> 

,如果你有自定義類別類型,然後你用這個代碼調用:

<?php the_field('starting_from', 'category_type_'.$cat->cat_ID); ?> 
+0

任何人利用這種困惑,'category_type'應該是你的自定義分類的slu slu。 – JacobTheDev 2014-10-15 20:12:51

相關問題