Hi,

I've had a hunt around and am struggling to find the information required.

I've setup a menu item based on Articles > Category Blog. The Read More text nicely links to the article. How do I get the Intro Image displayed to link to the relevant article?

At the moment when I hover above an image, it zooms in a bit - but is not clickable.

Please can I pointed in the right direction to make the required changes?

You may need to manually adjust your template’s layout:

Navigate to Extensions > Templates > Templates.

Select your active template and go to Overrides.

Go to HTML > com_content > category and locate the blog_item.php file.

Look for the following code that displays the intro image:

if (!empty($images->image_intro)) : ?>
<img src="<?php echo htmlspecialchars($images->image_intro); ?>" alt="<?php echo htmlspecialchars($images->image_intro_alt); ?>"/>
<?php endif; ?>

Modify it to wrap the image inside an anchor (<a>) tag linking to the article:

if (!empty($images->image_intro)) : ?>
<a href="<?php echo $this->item->link; ?>">
<img src="<?php echo htmlspecialchars($images->image_intro); ?>" alt="<?php echo htmlspecialchars($images->image_intro_alt); ?>"/>
</a>
<?php endif; ?>

Save the file and refresh your site.

This will ensure that clicking the intro image takes the user to the full article.

    Thank you for your reply francus641 .

    There is only one line of code that contains image_intro and that is...

    <?php echo LayoutHelper::render('joomla.content.intro_image', $this->item); ?>

    I have made the following change but the Intro Images all link to the site's homepage and not the individual articles.

    <a href="<?php echo $this->item->link; ?>">
    <?php echo LayoutHelper::render('joomla.content.intro_image', $this->item); ?>
    </a>

      Hi cssyeah.

      Unfortunately, the modified code is not working as expected.

      Aim/expected: when clicking on the Intro Image the article loads up, just like the Read More link.

      What's actually happening: when I click on each Intro Image it takes me to the homepage of the website.

      It looks like $this->item->link is not returning the correct article URL, possibly because of how Joomla is handling links in your template.

      Instead of $this->item->link, try using:

      <a href="<?php echo JRoute::_($this->item->link); ?>">
      <?php echo LayoutHelper::render('joomla.content.intro_image', $this->item); ?>
      </a>

      If the above still redirects to the homepage, replace $this->item->link with:

      <a href="<?php echo $this->item->readmore_link; ?>">
      <?php echo LayoutHelper::render('joomla.content.intro_image', $this->item); ?>
      </a>

      and clear cache for every single try

        Thank you for your reply francus641. I have tried both of the suggestions but the Intro Image is still taking me to the website's homepage.

        I'm trying to achieve the "Blog N/Sidebar" behaviour as seen in the JA Sport demo (https://www.joomlart.com/demo/ja-sport) under News > Blog n/ Sidebar where the Intro Images and Read More links take you to the article page.

        Just to confirm, did you enable the feature you're looking for before doing these tests?
        I imagine so, but in case you haven't checked:

        In the back-end: Content > Articles >
        on the top right side of the screen, click on [Options] >
        on the "Blog/Featured Layouts" tab at the bottom "Linked Intro Image",
        set it to "Yes".

        Of course, if you haven't done so before doing these tests that I recommended, restore the file to its original conditions.

          francus641, yes "Linked Intro Image" is toggled on.

          Interestingly, I've just downloaded the JA Titan template and installed. Using the below default worked:

          <?php echo LayoutHelper::render('joomla.content.intro_image', $this->item); ?>

          I then tested with the Cassiopeia template and that works fine too.

          I've no idea why the JA Sport template does not want to play ball!

          Hi @pixel8er,

          • First, restore all layout files to their original state.
          • Next step open the intro.php file in the "ja_sport/html/layouts/joomla/content/image/" folder. Change the below code.
            $params         = new Registry($item->attribs);
            to
            $params = $displayData->params;
            Save and reload your website to view the change.

            cssyeah

            If you don't override it, the next template update will lose all customization.
            If there is ever a template update of course.
            It seems to me that everything is going to pieces.
            It's been almost a year since a new template has come out and we've been paying for a monthly template.
            Is there anyone who can tell us once and for all what is happening to your company?

            Hi,
            I applied this code to the template package and It will not be lost if you update to a new version of the template.

            Kind regards,

            pixel8er I'm glad you solved it, and I apologize if I invaded your thread with my outburst.
            I also apologize to @cssyeah who is basically just doing his job, and does it well.
            But unfortunately, not being able to get answers, the frustration increases until you have reactions like today's.
            Sorry.

            Write a Reply...
            You need to Login to view replies.