iWizard
iWizard

Reputation: 7094

Advanced Custom Fields not printing field for category

I'm trying to print a custom field for a category but with no success.

This is my code:

     $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');

}

Upvotes: 2

Views: 5249

Answers (1)

iWizard
iWizard

Reputation: 7094

Solved.

If you need custom filed for category then you call with following code:

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

and if you have custom category type then you call with this code:

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

Upvotes: 8

Related Questions