• Resolved antirem

    (@antirem)


    Hello,

    Ive added a custom field called “smallimage” which contains a thumbnail size image for each post.

    On the side of my design I want to have a long listing of all the thumbnails with a link to each post.

    I’ve seen a few ways to do this but it messes up the normal post listing on the homepage, I assume its using the same variable.

    So, what php call can list every page with a thumbnail and have it so I can add an anchor and image?

    Thanks!

Viewing 5 replies - 1 through 5 (of 5 total)
  • esmi

    (@esmi)

    Thread Starter antirem

    (@antirem)

    Thank you very much, the restet code worked beautifully!

    I have a new problem now.

    The thumbnail listing should go on the right hand side of every page. It lists all the thumbnails of every post correctly on the homepage, but if I goto a posts page it only show the thumbnail for that post.

    My code is as follows.

    <?php if (have_posts()) : ?>
      <?php while (have_posts()) : the_post(); ?>
        <?php if(get_post_meta($post->ID, "small-image", true)) : ?>
          <a href="<?php the_permalink(); ?>" class="thumbnail"><img src="<?php echo get_post_meta($post->ID, "small-image", true); ?>" /></a>
        <?php endif; ?>
      <?php endwhile; ?>
    <?php endif; ?>

    I assume that have_posts is looking on the current page, and not going to the root of the site to look for posts.

    Thanks again,

    esmi

    (@esmi)

    The code you’ve posted will only display the custom image for the current post.

    Thread Starter antirem

    (@antirem)

    (bit belated, sorry)

    What code can I use for global posts? So that it will show ALL posts regardless of what page your on?

    Thanks!

    Thread Starter antirem

    (@antirem)

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Custom Field Image Listing’ is closed to new replies.