• Hello,

    I have a gallery field created using the ACF Photo Gallery Field plugin and it works great if creating the post from the backend. However, I need these to be created through a frontend form. I am using a Gravity Form to create the post. All goes well other than the gallery. When I view the post in the editor, I can see blank boxes for each image but the source is showing that they are in the Gravity Forms upload folder. I think I need something similar to this: https://gist.github.com/joshuadavidnelson/164a0a0744f0693d5746.

    However, I don’t know how to integrate this with the code for displaying the gallery. I am just using the your sample code:

    <?php
    		    //Get the images ids from the post_metadata
    		    $images = acf_photo_gallery('photos', $post->ID);
    		    $post_id = get_the_ID();
    		    //Check if return array has anything in it
    		    if( count($images) ):
    		        //Loop over it
    		        foreach($images as $image):
    		            $id = $image['id']; // The attachment id of the media
    		            $image_attributes = wp_get_attachment_image_src( $id, 'full' );
    		            $title = $image['title']; //The title
    		            $full_image_url = $image['full_image_url']; //Full size image url
    		            $thumbnail_image_url= $image['thumbnail_image_url']; //Get the thumbnail size image url
    		            $url= $image['url']; //Goto any link when clicked
    		            $target= $image['target']; //Open normal or new tab
    			?>
    					<dl class="gallery-item">
    						<dt class="gallery-icon">
    							<a class="rollover rollover-zoom dt-pswp-item pspw-wrap-ready this-ready" href="<?php echo $full_image_url; ?>" data-large_image_width="<?php echo $image_attributes[1]; ?>" data-large_image_height="<?php echo $image_attributes[2]; ?>">
    								<img src="<?php echo $thumbnail_image_url; ?>" alt="<?php echo $title; ?>" title="<?php echo $title; ?>" class="attachment-thumbnail size-thumbnail">
    								<i></i>
    			        		</a>
    						</dt>
    					</dl>
    					<?php endforeach; endif; ?>

    Thank you for any suggestions. I know this is not an issue with the plugin itself. I just need it to talk to Gravity Forms.

    The page I need help with: [log in to see the link]

The topic ‘Using Gravity Form to create post with gallery’ is closed to new replies.