Home Forums Add-ons Gallery Field View gallery image taxonomy in taxonomy custom page


View gallery image taxonomy in taxonomy custom page

  • Hi,

    I created a custom field “carousel_slider_quarzite” type ACF Gallery in term of custom taxonomy “collections.”

    In the category “Quartzite” taxonomy of “collections” appears “carousel_slider_quarzite” field with the images in my gallery.

    This gallery should be shown on the “taxonomy-collection-quarzite.php” but something wrong.


    $images = get_field('carousel_slider_quarzite');
    if( $images ): ?>
            <?php foreach( $images as $image ): ?>
                    <a href="<?php echo $image['url']; ?>">
                         <img src="<?php echo $image['sizes']['thumbnail']; ?>" alt="<?php echo $image['alt']; ?>" />
                    <p><?php echo $image['caption']; ?></p>
            <?php endforeach; ?>
    <?php endif; ?>

    the custom field gallery, present in the category “quartzite” must be shown in the template category page. You can help me?

    Sorry for my bad English
    Thank you

  • When getting values from a taxonomy term you must supply the correct post id. See the “Get a value from other places” section of get_field()

    $queried_object = get_queried_object();
    $post_id = $queried_object->taxonomy.'_'.$queried_object->term_id;
    $images = get_field('carousel_slider_quarzite', $post_id);
  • Thank you. and if I were to draw a field image “cover_collezione” in taxonomy custom “collezione” – post type “prodotto” in a page of my wordpress template?

  • I don’t understand your follow up question.

  • see custom fields image of a post type category in a page template? excuse my English

  • You will need to get the category that the post is in and then get the field from that category. Take a look at or

Viewing 6 posts - 1 through 6 (of 6 total)

The topic ‘View gallery image taxonomy in taxonomy custom page’ is closed to new replies.