Home Forums ACF PRO ACF Block, not showing Link field


ACF Block, not showing Link field

  • I created a series of custom blocks to pull in the featured image from a series of Custom posts – (Supporters/Sponsors) – these have custom taxonomy (supporter_level) applied – platinum, gold etc.
    The blocks work fine, but now we want to add links to the images- via a Link/URL field.
    The code is failing when used in the block, but when I use the same code in a test page-template, it works fine. I am obviously missing something, but can’t see what it is.
    In the image the top row of logos are displayed via the custom block. The lower is the same code, but is in the page-template file.
    See the code here:

  • The image does not seem to be showing, so here’s a direct link:

  • Resolved with the following:

    						$link	= get_field( 'supporterlink', get_the_id() );
    					if ( $link ) : ?>
    						<a href="<?php echo esc_url( $link ); ?>">
    					<?php endif; ?>
    						<img role="img" src="<?php the_post_thumbnail_url( 'medium' ); ?>" alt="<?php the_title(); ?>"/>
    					<?php if ( $link ) : ?>
    					<?php endif; ?>

    See updated Gist:

Viewing 4 posts - 1 through 4 (of 4 total)

The topic ‘ACF Block, not showing Link field’ is closed to new replies.