Not able to sort out a strategy to this. I've setup a custom template for my wordpress theme and am attempting to alter the bit where there's presently an echo from the category link and title for an echo from the title from the publish.

Presently the echo is:

echo '<h2><a href="'.$catLink.'" title="'.$category->name.'">'.$category->name.'</a></h2>';

Can anybody help please?

Full-page code is:

<div id="older-posts">
<?php
// Get the current category
foreach((get_the_category()) as $category) 
{ 
    $current_cat_id = $category->cat_ID; 
    break;
}

// Set the category to only the category selected
$args = array(
    'category__in' => array($current_cat_id),
    'orderby' => 'date',
    'order' => 'DESC'
);

$posts = new WP_Query();
$posts->query($args);

if ($posts->have_posts())
{
    while ($posts->have_posts())
    {
        echo '<div class="result">';
        echo '<h2><a href="'.$catLink.'" title="'.$category->name.'">'.$category->name.'</a></h2>';
        $posts->the_post();
        ?> 
        <div class="thumbnail">
                <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>">
                    <h3><?php the_title(); ?></h3>
                    <?php //get thumnbnail (custom field) ?>
                    <?php $image = get_post_meta($post->ID, 'thumbnail', true); ?>
                    <img src="<?php echo $image; ?>" title="<?php the_title(); ?>" />
                    <?php the_post_thumbnail(); ?>
                </a>
        </div>  </div>
        <?php 

    }   
}

// Reset global query
wp_reset_query();
?>

</div>

I do not get the point.. But do this

//just after while() start
                $posts->the_post();
?> 
    <div class="result">
    <h2><a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2>
                <div class="thumbnail">
                        <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>">
                            <h3><?php the_title(); ?></h3>
                            <?php //get thumnbnail (custom field) ?>
                            <?php $image = get_post_meta($post->ID, 'thumbnail', true); ?>
                            <img src="<?php echo $image; ?>" title="<?php the_title(); ?>" />
                            <?php the_post_thumbnail(); ?>
                        </a>
                </div>
</div>