Keyword

if Related items has no images

  • VADIMY
  • VADIMY's Avatar Topic Author
  • Offline
  • New Member
More
3 years 10 months ago #177706 by VADIMY
if Related items has no images was created by VADIMY
Hello all,
Question:
If I have Related items articles with no images, K2 show double title. Please see pic1
How I can configure K2 if no images in articles?
I need to see only title if no image in article, please see pic2
Appreciated in advance!
Attachments:

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

  • VADIMY
  • VADIMY's Avatar Topic Author
  • Offline
  • New Member
More
3 years 10 months ago #177730 by VADIMY
Replied by VADIMY on topic if Related items has no images
Happy New Year!
How I can configure K2 if no images in articles?
I need to see only title if no image in article, please advice.

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

More
3 years 10 months ago - 3 years 10 months ago #177764 by JoomlaWorks
Replied by JoomlaWorks on topic if Related items has no images
Assuming you already have overrides for "item.php" you can check if the K2 image propery exists (in each K2 item object coming from the related items loop - if (isset($item->image)) { ... }) and then either display a placeholder image or just use a different HTML structure.

So edit this line github.com/getk2/k2/blob/master/components/com_k2/templates/default/item.php#L474 from:
<?php if($this->item->params->get('itemRelatedImageSize')): ?>

to:
<?php if($this->item->params->get('itemRelatedImageSize') && !empty($item->image)): ?>

Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Last edit: 3 years 10 months ago by JoomlaWorks.

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

More
3 years 10 months ago #177776 by JoomlaWorks
Replied by JoomlaWorks on topic if Related items has no images
Also fixed in K2: github.com/getk2/k2/commit/af51b22b11112db5e68e0d4657dada06e59ab9f4

This will be part of K2 v2.10.4.

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

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

More
3 years 10 months ago #177777 by JoomlaWorks
Replied by JoomlaWorks on topic if Related items has no images
Forgot to mention that the title you see as duplicate is actually the "alt" text from the <img> tag. With the new check, this won't be visible obviously.

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

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

  • VADIMY
  • VADIMY's Avatar Topic Author
  • Offline
  • New Member
More
3 years 10 months ago #177810 by VADIMY
Replied by VADIMY on topic if Related items has no images
Thank you Fotis, but it definitely title+title.
No images in article.
This code (<?php if($this->item->params->get('itemRelatedImageSize') && !empty($item->image)): ?>) didn't help me.

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

More
3 years 10 months ago #177817 by JoomlaWorks
Replied by JoomlaWorks on topic if Related items has no images
Any chance some K2 images exist and some got deleted? K2 will check if the "Generic" size exists to determine whether K2 images are there for some item to use.

Fotis / 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