Viewing 4 replies - 1 through 4 (of 4 total)
  • Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    show your code — please put it on wpbin.io — and be sure to note the name you gave the custom field.

    Thread Starter joh123

    (@joh123)

    Hi, Steve & others!
    My page.php currently looks like this:

    https://wpbin.io/k0qlt

    My custom field is named ExternalURL (Advanced Custom Fields 4.4.12)

    I’d really appreciate if anyone knew what to do :/

    All the best!

    • This reply was modified 6 years, 6 months ago by joh123.
    Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    I don’t see anywhere in there that you’re using the URL you set up with ACF. I would expect to see a call to get_field() or the_field(). Please check the documentation for ACF to find out how to use these functions.

    https://www.advancedcustomfields.com/resources/get_field/

    You’d then wrap the post thumbnnail with it, something like

    echo '<a href=", get_field( 'externalurl' ),   '">';
    the_post_thumbnail( 'thumbnail' );
    echo '</a>';
    Thread Starter joh123

    (@joh123)

    Well yeah, that’s the case because I didn’t manage to make it work. Anyway, I’ll delegate this job to someone smarter because I’m running out of time. Thank you, Steve, for your help!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Featured image to act as a link to external URL’ is closed to new replies.