I'm using Gravity Forms to create a form. The form entry is created as a post. I have a loop that successfully gets the content of the post.
However, I'd also like to get the image that is submitted with the post. I have this snippet:
<?php wp_get_attachment_link($POST->ID) ; ?>
However, this makes returns nothing. This makes me think that either the code is incorrect, or that GF is storing the image in a way that differs from how normal post images are stored.
This is my full loop:
<?php global $query_string ; ?>
<?php $my_query = new WP_Query('&cat=4&posts_per_page=10') ?>
<?php while ( $my_query->have_posts()) : $my_query->the_post() ; ?>
<ul>
<li>
<img src="<?php wp_get_attachment_link() ; ?> " class="" alt="#" />
<a href="<?php the_permalink() ?>" title="Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a>
<?php the_content() ;?>
</li>
</ul>
How can I get the image?
wp_get_attachment_link()returns either a link to an image orMissing Attachment- have you tried to dodie( var_dump( wp_get_attachment_link( $post->ID ) ) );to see what's returned? – Jared Jan 22 '12 at 15:50