Keyword

if Related items has no images

  • VADIMY
  • VADIMY's Avatar Topic Author
  • Offline
  • New Member
More
4 weeks 2 days 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 weeks 2 days 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.

  • Fotis
  • Fotis's Avatar
  • Offline
  • Administrator
  • JoomlaWorks Support Team
More
3 weeks 9 hours ago - 3 weeks 7 hours ago #177764 by Fotis
Replied by Fotis 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)): ?>

If you use & love K2, please take a moment to add your review and rate it
at the Joomla Extensions Directory: extensions.joomla.org/extension/k2/


IMPORTANT: Please search the forum before posting a question!

JoomlaWorks Support Team Member
Last edit: 3 weeks 7 hours ago by Fotis.

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

  • Fotis
  • Fotis's Avatar
  • Offline
  • Administrator
  • JoomlaWorks Support Team
More
3 weeks 7 hours ago #177776 by Fotis
Replied by Fotis 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.

If you use & love K2, please take a moment to add your review and rate it
at the Joomla Extensions Directory: extensions.joomla.org/extension/k2/


IMPORTANT: Please search the forum before posting a question!

JoomlaWorks Support Team Member

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

  • Fotis
  • Fotis's Avatar
  • Offline
  • Administrator
  • JoomlaWorks Support Team
More
3 weeks 7 hours ago #177777 by Fotis
Replied by Fotis 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.

If you use & love K2, please take a moment to add your review and rate it
at the Joomla Extensions Directory: extensions.joomla.org/extension/k2/


IMPORTANT: Please search the forum before posting a question!

JoomlaWorks Support Team Member

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

  • VADIMY
  • VADIMY's Avatar Topic Author
  • Offline
  • New Member
More
2 weeks 6 days 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.

  • Fotis
  • Fotis's Avatar
  • Offline
  • Administrator
  • JoomlaWorks Support Team
More
2 weeks 6 days ago #177817 by Fotis
Replied by Fotis 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.

If you use & love K2, please take a moment to add your review and rate it
at the Joomla Extensions Directory: extensions.joomla.org/extension/k2/


IMPORTANT: Please search the forum before posting a question!

JoomlaWorks Support Team Member

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


Powered by Kunena Forum