crazyflx
Elite Member
- Nov 9, 2009
- 1,623
- 4,870
I'm using a theme on my wordpress blog called "scarlett"
You can view a working example of it here (it isn't mine): http://idonteatthat.com/
You'll see on the right hand side, directly above the video (Hitler wants subway??) there are four posts, each has a thumbnail picture next to the post title.
That thing rotates between all the posts a blog has on it, and automatically takes a picture from a custom field called "screen" (which the user fills in when making their post) and makes a thumbnail out of it.
Well, on my blog, I don't always use the custom field, so I have blog posts appearing in that sidebar (which is referred to as a "feature list" and uses the PHP file featlist.php) that don't have images.
I would like to make that sidebar only show posts IF the custom field "screen" was used while making the blog post, so that only posts with pictures appear there.
Here is the code for "featlist.php" :
You can view a working example of it here (it isn't mine): http://idonteatthat.com/
You'll see on the right hand side, directly above the video (Hitler wants subway??) there are four posts, each has a thumbnail picture next to the post title.
That thing rotates between all the posts a blog has on it, and automatically takes a picture from a custom field called "screen" (which the user fills in when making their post) and makes a thumbnail out of it.
Well, on my blog, I don't always use the custom field, so I have blog posts appearing in that sidebar (which is referred to as a "feature list" and uses the PHP file featlist.php) that don't have images.
I would like to make that sidebar only show posts IF the custom field "screen" was used while making the blog post, so that only posts with pictures appear there.
Here is the code for "featlist.php" :
Code:
<div id="postlist">
<ul class="spy">
<?php $my_query = new WP_Query('orderby=rand'); ?>
<?php while ($my_query->have_posts()) : $my_query->the_post();?>
<li>
<?php $screen = get_post_meta($post->ID, 'screen', $single = true);
if ($screen !="")
{?>
<img src="<?php bloginfo('stylesheet_directory'); ?>/timthumb.php?src=<?php echo $screen; ?>&h=60&w=100&zc=1" alt=""/>
<?php
}
?>
<h2><a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2>
<div class="fcats"><?php the_category(', '); ?> </div>
<div class="auth"> Posted by <?php the_author(); ?> </div>
</li>
<?php endwhile; ?>
</ul>
</div>
<div class="clear"></div>