Additional Fields not working in frontend
-
Hey! First of all thanks for the awesome work!
I have a problem with the additional fields. It works fine in the backend and I see the updated values for each image there. If I want to pull the fields in the fronend it does not work. Do you have an idea what I’m doing wrong?
functions.php
//Create extra fields for ACF Photo Gallery Field function my_extra_gallery_fields( $args, $attachment_id, $field ){ // Model Insta Link Field for Gallery $args['insta_link'] = array( 'type' => 'text', 'label' => 'Model Insta Link', 'name' => 'insta-link', 'value' => get_field($field . '_insta_link', $attachment_id) ); // Model Insta Name Field for Gallery $args['insta_name'] = array( 'type' => 'text', 'label' => 'Model Insta Name', 'name' => 'insta_name', 'value' => get_field($field . '_insta_name', $attachment_id) ); return $args; } add_filter( 'acf_photo_gallery_image_fields', 'my_extra_gallery_fields', 10, 3 );Frontend
$id = $image['id']; $title = $image['title']; $caption= $image['caption']; $instaLink = get_field('photo_gallery_insta_link', $id); // not working $instaName = get_field('photo_gallery_insta_name', $id); // not working $fullImageUrl = $image['full_image_url']; var_dump($instaLink); // <-- gives NULL var_dump($instaName); // <-- gives NULLThanks!
The page I need help with: [log in to see the link]
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
The topic ‘Additional Fields not working in frontend’ is closed to new replies.