Home Forums Front-end Issues Image not displaying


Image not displaying

  • Hi All,

    I’ve created a very simple image variable for a WordPress project:

    <div class="container blog_info">
    	while(have_posts()) {
    		<div class="post-item">
    			<div class="post-image"><img src="<?php echo $post_image ?>"></div>
    			<h2 class="blog_heading">
    			<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
    			<?php the_excerpt(); ?>
    			<a class="btn-blog" href="<?php the_permalink(); ?>">More &raquo;</a>
    	<?php }

    For some reason the selected image does not display:

    <?php echo $post_image ?>
    <?php $post_image = get_field(“post_image”); ?>

    I’m obviously missing something! Thanks in advance 🙂

  • What is the return values setting of your image field?

    Is your code incomplete?

    To use what you are using the return value for your field needs to be set to URL

    <img src="<?php $post_image = get_field('post_image'); echo $post_image; ?>">


    <img src="<?php the_field('post_image'); ?>">
Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.