WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] display image from custom field (9 posts)

  1. juliabarry
    Member
    Posted 1 year ago #

    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!!

  2. 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.

  3. juliabarry
    Member
    Posted 1 year ago #

    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?

    Thanks!!

  4. Have you tried

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

  5. juliabarry
    Member
    Posted 1 year ago #

    You are my hero. Thanks!

  6. Awesome. Glad I could help.

  7. juliabarry
    Member
    Posted 1 year ago #

    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.

    Thanks!

  8. juliabarry
    Member
    Posted 1 year ago #

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

  9. . 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!!

  • juliabarry
    Member
    Posted 1 year ago #

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

  • Topic Closed

    This topic has been closed to new replies.

    About this Topic

    Tags