Post Thumb Script
-
Establishing info. I have Exec-PHP (to execute PHP in Text widgets), and a custom field “Image” for _certain_ posts.
I am trying to get this code to work:
<?php query_posts('cat=5,10'); ?> <?php while ($pt_count=>3) : the_post(); ?> <?php if get_post_custom_values("Image") { ?> <div class="thumbnails" style="text-align=center;"> <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"> <img src="<?php $values = get_post_custom_values("Image"); echo $values[0]; ?>" alt="" /> </a></div> <?php ; $pt_count++ } endwhile; ?>
The idea is to display 3 thumbnails from the selected categories. I would have passed ‘showposts=3’ but if there isn’t an image for the post, I don’t want the code to be written, and I want to be sure that 3 display.
Any ideas?
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘Post Thumb Script’ is closed to new replies.