<div id="leftcol">
<?php
// "Featured articles" (Nyheter) module begins
query_posts('showposts=3&cat=15'); ?>
<h3> Nyheter </h3>
<?php while (have_posts()) : the_post(); ?>
<div class="feature">
<?php
$basePath = get_option('upload_path') . '/';
$permaLink = get_permalink();
// this grabs the image filename ffrom image gallery
$values = get_post_custom_values("featuredarticleimage");
// this checks to see if an image file exists
if(empty($values[0]))
{
//Grab url to external image
$values = get_post_custom_values("externalthumb");
$basePath = '';
}
// If and image has been related, it will be displayed
if(!empty($values[0]))
{
echo '<a href="' . $permaLink . '">';
echo '<img src="' . $basePath[0] . $values[0] . '" alt="artikkelbilde" />';
echo '</a>';
}
?>
<a href="<?php the_permalink() ?>" rel="bookmark" class="title">
<?php the_title(); ?>
</a>
<p>
<?php the_content_rss('Les mer','', '', 20); ?>
<a href="<?php the_permalink() ?>">Les mer</a>.
</p>
</div>
<?php endwhile; ?>
</div>
<!--END LEFTCOL-->
See the line echo ‘<img src=”‘ . $basePath[0] . $values[0] . ‘” alt=”artikkelbilde” />’; ?
I will replace ‘artikkelbilde’ with the_title() and the new code looks like this:
echo ‘<img src=”‘ . $basePath[0] . $values[0] . ‘” alt=”‘ . the_title() . ‘” />’;
You can see the result here.
Notice the small linked text in front of the headline. This is the ALT text. If you look at the source code, you will see alt=””.