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;”>
</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?
-
<?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;”>
</div>
<?php ; $pt_count++ } endwhile; ?>
-
<?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; ?> -
-
Are you hosted here at wordpress.com? If so, your php script will be stripped out by the software here. Nothing by straight html (and limited at that) is allowed to be added by bloggers. No javascript, no shockwave flash, no iframes, no forms.
-
I have my own server, and I have the plug-in Exec-PHP to allow PHP code in widgets, posts, and pages.
-
-
Since we don’t have access to any of the backend files, and most around here don’t know thing one about php, you need to inquire over at http://wordpress.org/support/ . WordPress.com is a free-hosted blogging service using a different version of the software than what you are using.
WordPress.com and WordPress.org – The difference: https://en.forums.wordpress.com/topic.php?id=3700&replies=1
-
- The topic ‘Post Thumb Script’ is closed to new replies.