Making these displayed images link to the articles

More
3 years 4 months ago #49422 by kent8
On this page:
recreation.townoflimon.com/index.php/youth-sports

The sports activities are displayed using the Newsflash type module.
The titles are linked to the respective articles.
The client has asked that I make the images link to the articles as well.
The module settings does not provide for this.
Can you please tell me how to make the images link to the articles in this Newsflash display module?

Thank you
Kent
 

Please Log in to join the conversation.

More
3 years 4 months ago - 3 years 4 months ago #49430 by milos
Hello,

You must create a newsflash module override. I guess you are using the module "mod_articles_news". You should copy this file:

/modules/mod_articles_news/tmpl/_item.php

to this folder (create the folder)

/templates/fitness/html/mod_articles_news/_item.php

Then open the copied file and change this part:
Code:
<figure class="newsflash-image"> <?php echo LayoutHelper::render( 'joomla.html.image', [ 'src' => $item->imageSrc, 'alt' => $item->imageAlt, ] ); ?> <?php if (!empty($item->imageCaption)) : ?> <figcaption> <?php echo $item->imageCaption; ?> </figcaption> <?php endif; ?> </figure>

to this:
Code:
<figure class="newsflash-image"> <a href="<?php echo $item->link; ?>"> <?php echo LayoutHelper::render( 'joomla.html.image', [ 'src' => $item->imageSrc, 'alt' => $item->imageAlt, ] ); ?> </a> <?php if (!empty($item->imageCaption)) : ?> <figcaption> <?php echo $item->imageCaption; ?> </figcaption> <?php endif; ?> </figure>

If it doesn't work you probably missed the file or the folder or the module. More details about module override here: docs.joomla.org/Understanding_Output_Overrides (read the section Module Layout Overrides).

Regards,
Milos
Last edit: 3 years 4 months ago by milos.
The following user(s) said Thank You: kent8

Please Log in to join the conversation.

Time to create page: 0.220 seconds
Powered by Kunena Forum