Support

Account

Home Forums General Issues Query subcategories and custom fields

Unread

Query subcategories and custom fields

  • Hey there,

    I am trying to open up a query that gets all subcategories of a certain paren category and displays the content of custom fields, including a category image. Is there a way to retrieve it flawlessly?

    Here is what I use for the subcategory query:

    <?php $categories =  get_categories('child_of=1&hide_empty=0');
    foreach ($categories as $category) : ?>
    
            <div class="cat_list_item grid_4">
                <a href="<?php get_category_link( $category->term_id ); ?>" title="<?php echo $category->name; ?>">
                    <?php echo $category->name; ?>
                </a>
                <h4>
                    <span class="caption">
                        <?php echo $category->name; ?>
                    </span>
                </h4>
                <p>
                    <span class="caption">
                        <?php echo $category->description; ?>
                    </span>
                </p>
            </div>
    <?php endforeach; ?>
    

    Is there a way to include my desired custom fields created with ACF?

    Thanks in advance :)!

    physalis

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.