linkable image for related article

GK User
Sat May 02, 2015 12:16 am
Dear Team,

I' d like to show in k2 items (blog), under "related items" section, all articles related by tags with title.
Following this post ( https://www.gavick.com/forums/news-joom ... ages-23678 ) I was able to do it, but I need to go further in order to avoid bad user experience:

Indeed, at the moment only the title is linkable, how can I make the image linkable as well?

A user should reach a related article just tapping the image,

I'd really appreciate some tips of code for that,

Thanks in advance,

Roberto
User avatar
Expert Boarder

teitbite
Sun May 03, 2015 12:40 pm
Hi

Edit file /html/com_k2/templates/default/item.php and add this to the related items part:

Code: Select all
            <?php if($this->item->params->get('itemRelatedImageSize')): ?>
            <a class="itemRelTitle" href="<?php echo $item->link ?>"><img style="width:<?php echo $item->imageWidth; ?>px;height:auto;" class="itemRelImg" src="<?php echo $item->image; ?>" alt="<?php K2HelperUtilities::cleanHtml($item->title); ?>" /></a>
            <?php endif; ?>
User avatar
Moderator


cron