Home Forums General Issues the_image not returning value in media attachments Reply To: the_image not returning value in media attachments

  • Hey Elliot,
    Thanks for the prompt reply. This is just a function I’m running that pulls a field from the image/attachment meta. So it would be the page.php template, I suppose. This is a genesis child theme, too, if that helps.

    In the function I didn’t declare the global $post variable originally, but I did just now and it didn’t seem to change anything. I tried getting the field using the_field() method and also as a variable and neither seemed to work.

    Here’s teh function in full, don’t mind the ugly code. =)

    add_action( 'genesis_before_loop', 'ds_add_featured_image', 1 );
    function ds_add_featured_image() {
    	global $post;
    	$variable = get_field('featured_image_link');
    	<div class="featured-image">
    		<a href="<?php get_field( $variable ); ?>" title=""><?php the_post_thumbnail(); ?></a>
    		<span class="caption"><?php  get_post( get_post_thumbnail_id() )->post_excerpt;?> </span>
    <?php }