Keyword

Link on category image

  • Tristan
  • Tristan's Avatar Topic Author
  • Offline
  • New Member
More
10 years 10 months ago #120953 by Tristan
Link on category image was created by Tristan
Hi,

On my website I use K2 with category listing view with image and title on home page.
Only the title text can have a link on category listing not the images.
See: www.moda4season.com/

On item listing both image and title have links.

Is is possible to do that?

Thanks !!

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

  • Yiota
  • Yiota's Avatar
  • Visitor
10 years 10 months ago #120954 by Yiota
Replied by Yiota on topic Re: Link on category image
You just have to remove the link from the image. To do this you will have to create a K2 template override (read here on how the overrides work getk2.org/documentation/tutorials/174-templating-with-k2-and-the-concepts-of-sub-templates) and edit the category_item.php file. Locate the image block and remove the element. This will remove the link of the listing's image.

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

  • Tristan
  • Tristan's Avatar Topic Author
  • Offline
  • New Member
More
10 years 10 months ago #120955 by Tristan
Replied by Tristan on topic Re: Link on category image
Hi,

Thanks for your fast reply I mean add a link on images not remove it.
Thanks for the override link, it's already done.

If you watch the link you'll see that there's no links on images: www.moda4season.com/

Thank you !

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

  • Yiota
  • Yiota's Avatar
  • Visitor
10 years 10 months ago #120956 by Yiota
Replied by Yiota on topic Re: Link on category image
Ok. So I see that you have modified the category_item.php already and fetching the category image for each item. Am I right?

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

  • Tristan
  • Tristan's Avatar Topic Author
  • Offline
  • New Member
More
10 years 10 months ago #120957 by Tristan
Replied by Tristan on topic Re: Link on category image
Yep, the images on home page (the link) are the image from categories.

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

  • Yiota
  • Yiota's Avatar
  • Visitor
10 years 10 months ago #120958 by Yiota
Replied by Yiota on topic Re: Link on category image
Just put the <a> element you have on the category title in the category image as well.

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

More
10 years 6 months ago #120959 by Chris Wilcox
Replied by Chris Wilcox on topic Re: Link on category image
Could any kind person expand on how to do this in a little more detail?

I believe I have a similar situation - we wish to have a category list, and hide everything on this list except for the category image.

We'd then like to have the image clickable, so that viewers of our site can click the category image and go to view the items within that category.

At the time of writing this post, and playing purely with a demo, we have this (No images updated yet apart from one or two):

www.haltwhistlecommunitycampus.co.uk/j14/

Thanks,

Chris

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

More
10 years 6 months ago #120960 by Lefteris
Replied by Lefteris on topic Re: Link on category image
The following code will make the category image linkable in the category.php layout of K2:
<a href="<?php echo $this->category->link; ?>">
<img alt="<?php echo K2HelperUtilities::cleanHtml($this->category->name); ?>" src="<?php echo $this->category->image; ?>" style="width:<?php echo $this->params->get('catImageWidth'); ?>px; height:auto;" />
</a>

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

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


Powered by Kunena Forum