K2 related items with images
To view K2 related items with images on item page. Open com_k2->templates->default->item.php and search for
<?php if($this->item->params->get('itemRelated') && isset($this->relatedItems)): ?> <!-- Related items by tag --> <div class="itemRelated"> <h3><?php echo JText::_("Related items (by tag)"); ?></h3> <ul> <?php foreach($this->relatedItems as $key=>$item): ?> <li class="<?php echo ($key%2) ? "odd" : "even"; ?>"> <a href="<?php echo $item->link ?>"><?php echo $item->title; ?></a> </li> <?php endforeach; ?> </ul> <div class="clr"></div> </div> <?php endif; ?>
and replace with
<?php if($this->item->params->get('itemRelated') && isset($this->relatedItems)): ?> <!-- Related items by tag --> <div class="itemRelated"> <h3><?php echo JText::_("Related items (by tag)"); ?></h3> <ul> <?php foreach($this->relatedItems as $key=>$item): ?> <li class="<?php echo ($key%2) ? "odd" : "even"; ?>"> <div class="related-item"> <a href="<?php echo $item->link ?>"><img src="<?php echo $item->imageXSmall; ?>" alt="<?php echo $item->title; ?>" /></a> <br /> <a href="<?php echo $item->link ?>"><?php echo $item->title; ?></a> </div> </li> <?php endforeach; ?> </ul> <div class="clr"></div> </div> <?php endif; ?>
Recent Comments