WordPress.org

Ready to get started?Download WordPress

Forums

Just Custom Fields
[resolved] Duplicate images with just_custom_image (3 posts)

  1. aboutaaron
    Member
    Posted 2 years ago #

    For some reason when I use just_custom_image in my page template, it prints two images.

    Here's the code below:

    $args = array( 'numberposts' => 3, 'order'=> 'DESC', 'orderby' => 'post_date', 'category' => 258);
    $postslist = get_posts( $args );
    foreach ($postslist as $post) :  setup_postdata($post); ?>
      <div class="span2">
        <a href="<?php echo get_post_meta($post->ID, 'award-link', true); ?>">
          <?php echo just_custom_image($post->ID, 'award-image'); ?>
        </a>
      </div>
    <?php endforeach; ?>

    So this prints two img tags with uploaded image from the 'award-image' Custom Field.

    Any idea why?

    http://wordpress.org/extend/plugins/just-custom-fields/

  2. tebothibeau
    Member
    Posted 2 years ago #

    Not sure if you've solved this or not. Try removing "echo" from in front of just_custom_image.

    So it would be:

    <?php just_custom_image($post->ID, 'award-image'); ?>

  3. Alexander Prokopenko
    Member
    Plugin Author

    Posted 2 years ago #

    yeap, tebothibeau is correct.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic