Sign In
Username or Email
Password
Forgot your password?
Forgot your username?
K2 | The powerful content extension for Joomla! developed by JoomlaWorks
home
about
blog
documentation
extend K2
showcase
community
demo
Leverage the power of rich media publishing the easy way!
William White
http://williamwhitejr.com/
http://williamwhitejr.com/index.php/k2-support/submit-a-support-request
Social Profiles
Facebook
Twitter
Extra field image type as link
19 January 2013
in
Tips & Tricks
If you have an image type extra field and need to display a link directly to the image you must strip the default code that K2 uses to insert the image into it's foreach loop. You can insert 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>" ;
?>
More
Tags:
extra fields
,
images