Support » How-To and Troubleshooting » [Resolved] display image from custom field

[Resolved] display image from custom field

  • I’ve created a custom field where the client can upload her own thumbnails which are meant to display in a grid. I can get the object, URL, or ID text to print/echo, but I’m having trouble getting the actual images to display.

    I called in the url like this:

    <?php $imgurl="<?php the_field('video_thumbnail_image') ?>";

    And here I’m stuck, despite lots of Googling and trying different functions, on what php will get the images from those URLs’ variables…

    $imgprint = ?????

    …that I can then echo:
    <img src="<?php echo $imgprint; ?>" width="290">

    I can easily generate and call the image object or ID in the first step instead, if using URLs is part of the problem.

    Thanks for your help!!

Viewing 8 replies - 1 through 8 (of 8 total)
  • Christine Rondeau


    Volunteer Forum Moderator

    I don’t think that you need to call the url.
    I would simply use:

    <img src="<?php the_field( 'video_thumbnail_image' ); ?>" />

    if you’ve set the image to use the url (in the advanced custom fields settings), that should do it.

    Thanks for the reply! That worked like a charm, and I love how simple it is!

    But now I’m having a problem where the “rel=prettyPhoto” value that cues a js popup isn’t working for some reason. I’m using
    <a href="<?php the_field('link_url') ?>">
    to pull in the link, which still does seem to be working (it’s just opening in a new window instead of cuing the popup).

    Do you know what’s interfering/what I did wrong?


    Christine Rondeau


    Volunteer Forum Moderator

    Have you tried

    <a "rel=prettyPhoto" href="<?php the_field('link_url') ?>">

    You are my hero. Thanks!

    Christine Rondeau


    Volunteer Forum Moderator

    Awesome. Glad I could help.

    Er, one more question along the same lines.

    I’m trying to add a Read More link, and I see that the theme I’m building on has changed excerpt_more to path_excerpt_more.

    But when I try to use that like this:

    <div class="entry-summary clear">
    			<?php the_excerpt(); ?><?php path_excerpt_more(); ?>
    		</div><!-- .entry-summary -->

    …nothing happens. What else do I have to do to get it print the link?

    I also tried just hard coding it in, but the link just refers back to the homepage, rather than connecting to the blogpost’s URL:
    <?php the_excerpt(); ?><a href="<?php get_permalink($post->ID) ?>">Read more</a>

    We’re not using <!–more–> to create the excerpt, but rather the excerpt meta box on the post page, if that makes a difference.


    Also having the same problem trying to use these sort of php calls inside of

  • . I don’t know enough about php — is this not possible? How can I used a slider that relies on ul’s and call in dynamic content from posts?
  • Extra thanks!!

Whoa, looks like something weird happened with my last post. I was asking about using php inside of <li> (list items).

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘[Resolved] display image from custom field’ is closed to new replies.