hey,
Ive done more thinking since I last posted a thread about images with a foreach() loop.
But I want to specify 2 different arrays, and use foreach() to go through both of them simultaneously.
Here's my code:
What I would like to do specifically is have each iteration of $display_categories be called through the <?php echo get_category_link();?> function, so that the link goes to a different category from the links in the $lead_category array.
Is there any easy way to do this?
Thank you for your help!!!
<div id="rightcol">
<?php
// this is where you enter the IDs of which categories you want to display
$lead_categories = array(49,50,53,52,51);
$display_categories = array(23,24,21,29,20);
foreach ($lead_categories as $category) { ?>
<div class="clearfloat">
<?php query_posts("showposts=1&cat=$category");
$wp_query->is_category = false;
$wp_query->is_archive = false;
$wp_query->is_home = true;
?>
<h3><a href="<?php echo get_category_link($category);?>"><?php
// this is where the name of each category gets printed
single_cat_title(); ?></a></h3>
<?php while (have_posts()) : the_post(); ?>
<?php
// this grabs the image filename
$values = get_post_custom_values("Image");
// this checks to see if an image file exists
if (isset($values[0])) {
?>
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><img src="<?php bloginfo('template_url'); ?>/images/<?php $values = get_post_custom_values("Image"); echo $values[0]; ?>" width="125" height="80" alt="" /></a>
<?php } ?>
<a href="<?php the_permalink() ?>" rel="bookmark" class="title"><?php
// this is where title of the article gets printed
the_title(); ?>»</a>
<?php the_excerpt(); ?>
<?php endwhile; ?>
</div>