Help looping through images to use as thumbnail images.
Hello everyone. First post here!
We keep a Wordpress blog using a tweaked Wordpress theme called Hybrid News. This sets up a front page that has an excerpt and a thumbnail image. You can see what I'm talking about here:
Problem is, setting a thumbnail image isn't possible from an iPhone, and it's tough to write fast posts that look good.
What I'm trying to set up is a way to LOOP through an image array, based on the category I set for the post.
So if a post is in category "SQ" for instance, I'd like to have an array of 3 images. A post to "SQ" would use image 1, next post would use image 2, next post image 3, following post would then start over at image 1.
Right now I'm using this code, which only has a default image per category, and adds the thumbnail to the appropriate slot on the theme's front page:
How could I build a "well" of images so instead of having one default, there's 3, and each time I post, the thumbnail becomes the next image in the array? I'm figuring it's using some kind of loop. I admit to being a PHP newbie, and while I found some interesting information here:
if ( in_category( 'SQ' ) )
$default_image = 'http://www.jokeandbiagio.com/wp-content/uploads/2009/09/twitterview_scream_queens_th.jpg';
elseif ( in_category( 'field' ) )
$default_image = 'http://www.jokeandbiagio.com/wp-content/uploads/2009/10/Mission-X-Tommy-Gun-Garage.jpg';
elseif ( in_category( 'office' ) )
$default_image = 'http://www.jokeandbiagio.com/wp-content/uploads/2009/09/typewriter-keys-blue_med.jpg';
<?php get_the_image( array( 'custom_key' => array( 'Medium', 'Feature Image' ), 'default_size' => 'medium', 'default_image' => $default_image ) ); ?>
and on this forum here:
I haven't been able to figure out how to implement the idea of an image array loop into the above code.
Thanks so much for any help!
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Tags for this Thread