Displaying A Link Directly To The Extra Field Image?
Friends! If you want to display link directly to your extra field image then you must strip the default code that K2 uses to insert the image into it’s foreach loop.
You can do it by inserting this directly into your item.php override file.
You can do it by inserting this directly into your item.php override file.
<?php
$var = $this->item->extraFields->Image->value ;
$var = preg_replace(‘/<img src=”/’,””,$var);
$var = preg_replace(‘/” alt=”Image” \>/’,” “,$var);
echo ‘<a href=”‘ . $var . “TextOfLink” . “</a>” ;
?>
$var = $this->item->extraFields->Image->value ;
$var = preg_replace(‘/<img src=”/’,””,$var);
$var = preg_replace(‘/” alt=”Image” \>/’,” “,$var);
echo ‘<a href=”‘ . $var . “TextOfLink” . “</a>” ;
?>
Latest posts by LT Digital Team (Content & Marketing) (see all)
- 7+ Best WordPress Crypto Plugins - April 24, 2024
- Taking Inspiration From One of the World’s Leading Eyewear Ecommerce Sites: Eyebuydirect - March 22, 2024
- Navigating Success: The Role of UX/UI Agencies in Business Growth - March 12, 2024
Recent Comments