Keyword

Replace Extra Field Name with an Image

  • Manu Khanna
  • Manu Khanna's Avatar Topic Author
  • Offline
  • New Member
More
10 years 6 months ago #125911 by Manu Khanna
Replace Extra Field Name with an Image was created by Manu Khanna
Hi, I am fairly new to K2 and just getting used to it. Pretty neat component, I think it's the solution for my blog I'm designing right now.

With the "extra fields" I was hoping to gain a little bit of extra flexibility. Let's use this page as an example to keep things simple.

The Extra Fields are shown under the heading "Additional Info" which is great, however I would like to replace the text "Spotify" "Amazon" etc. with an icon representing that website. So for Amazon I would use this icon : and then on the right it would still say "Buy on Amazon".

Does that make sense? Within the K2 Extra Fields settings if I try to replace the Name with HTML code such as <img src="images/icons/amazon25px.png" alt="Buy on Amazon" /> it does not accept it.

Any workaround for making this work the way I'm trying to get it to work?

Appreciate any help.

Please Log in or Create an account to join the conversation.

  • Mohamed Abdelaziz
  • Mohamed Abdelaziz's Avatar
  • Offline
  • Platinum Member
  • Joomla Developer
More
10 years 6 months ago #125912 by Mohamed Abdelaziz
Replied by Mohamed Abdelaziz on topic Re: Replace Extra Field Name with an Image
Hello Manu,

This can be done by overriding item.php file, and to use the field alias method instead, and use link fields instead of text fields.

Try to read about template overrides, then you will be able to display fields in this way, for example the Amazon field with alias 'Amazon':
<img src="images/icons/amazon25px.png" alt="Buy on Amazon" /><?php echo $this->item->extraFields->Amazon->value; ?>

This code will be repeated for each field

Multiple Extra Fields Groups for K2
AutoMeta for K2
Chained Fields for K2
More K2 Extensions In My Extensions Store

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum