First, many thanks to HelgatheViking for stepping in to solve a tricky custom loop problem for this project.
I am now trying to add three bits of custom field data to this custom loop only when they are available (in event category).
The code below shows the new loop with my revisions included between the //Begin caa revisions and // END caa Revisions markers. The addition DOES successfully call the meta data and display it properly*, EXCEPT that it then gets caught up in the post count and so multiplies for each post. See http://seacliffmm.com/prod/indigest/admin/?cat=2213 (Events category page) for demo.
What am I missing in order to get the custom field data for each post to display only beneath its own post-thumbnail and not multiply under under other posts' post thumbnails?
/*
* LOOPS
*/
//default loop
function kia_default_loop(){
global $options, $blog_id;
if($options) foreach ($options as $value) {
if (get_option( $value['id'] ) === FALSE) {
$$value['id'] = $value['std'];
} else {
if (THEMATIC_MB)
{
$$value['id'] = get_option($blog_id, $value['id'] );
}
else
{
$$value['id'] = get_option( $value['id'] );
}
}
}
/* Count the number of posts so we can insert a widgetized area */ $count = 1; $column = 1;
while ( have_posts() ) : the_post();
$counter++;
thematic_abovepost(); ?>
<div class="column <?php if ($counter == 1) { echo 'one'; $clear=false; } else { echo 'two'; $counter = 0; $clear=true;} ?>">
<div id="post-<?php the_ID();?>" <?php post_class();?> >
<?php
$category = get_the_category();
if ($category) {
$catlink = '<a class="cat-link" href="' . get_category_link( $category[0]->term_id ) . '" title="' . sprintf( __( "View all posts in %s" ), $category[0]->name ) . '" ' . '>' . $category[0]->name.'</a> ';
}
?>
<div class="entry-thumb">
<?php if(has_post_thumbnail()) {
the_post_thumbnail('homepage-thumb');
} else {
echo '<a class="entry-thumb" href="' . get_permalink() . '" title="Permalink to ' . get_the_title() . '" ><img class="attachment-300x150 wp-post-image" src="' . get_stylesheet_directory_uri(). '/images/featured-image.png"/></a>';
}
echo $catlink;
?>
</div><!--.entry-thumb-->
<?php // Begin caa Revisions
global $post;
$eventdate = get_post_meta($post->ID , 'event-date', true);
$eventtime = get_post_meta($post->ID , 'event-time', true);
$eventprice = get_post_meta($post->ID , 'event-price', true);
?>
<div class="eventdetails">
<?php
if($eventdate && $eventtime){
$event .= '<p><strong>'.$eventdate.' | '.$eventtime.' | '.$eventprice.' </strong></p>';
}
echo $event;
?>
</div><!--.eventdetails-->
<?php // END caa Revisions ?>
<?php echo thematic_postheader(); ?>
<div class="entry-content">
<?php
the_excerpt();
//echo '<a class="read-more" href="' . get_permalink( get_the_ID() ) . '" title="' . sprintf( __( "Permalink to %s" ), get_the_title() ) . '" ' . '>' . __('more').' ></a> ';
?>
<?php wp_link_pages('before=<div class="page-link">' .__('Pages:', 'thematic') . '&after=</div>') ?>
</div><!-- .entry-content -->
<?php //thematic_postfooter(); ?>
</div><!-- #post -->
</div><!-- .column -->
<?php
thematic_belowpost();
comments_template();
if($clear) {
echo '<div class="clear"></div>';
}
endwhile;
}
* I was so proud of myself getting this to work this far--and then I saw the multiple displays.