ACF multi taxonomy on filterable gallery

Instead of getting all of the image IDs and then cycling through them and outputting each one, you would first collect them into a single array and then use array_unique() to remove the duplicates. if( $categories_du_projet ) : $image_array(); foreach( $categories_du_projet as $term ) : if( $image_du_projet ) : $image_array[] = $image_du_projet; endif; endforeach; $image_array … Read more

Shortcode for Custom Field of Media Attachment (to use with Featured Images)

The most basic option I can think of is this add_shortcode(‘bt_featured_image_acf_location’, ‘bt_featured_image_acf_location’); function bt_featured_image_acf_location ($atts) { return get_field(‘location’, get_post_thumbnail_id()); } Change ‘location’ to your acf field name and thats it. get_post_thumbnail_id() will get the current post featured image id. Once you have the ID of the post (images are posts, they are of the post … Read more