#75 - How to add an article title to the Read more... link

How to add an article title to the “Read more...” link?

Ok, so you'd like something fancier than "Read More" - not exactly very descriptive is it? Using template overrides you can achieve a better looking "Read More" link . 

If they are not already there, in your template folder: create a new folder called 'html' in your template folder /templates/<yourtemplate> In that folder you create a folder called 'com_content' and in that folder you create the folders called "category", "frontpage", "section"

Find the following files 

  • (joomla)/components/com_content/views/category/tmpl/blog_item.php
  • (joomla)/components/com_content/views/frontpage/tmpl/default_item.php
  • (joomla)/components/com_content/views/section/tmpl/blog_item.php
 Copy the files to your template's html folders 
  • (yourtemplate)/html/com_content/category/blog_item.php
  • (yourtemplate)/html/com_content/frontpage/default_item.php
  • (yourtemplate)/html/com_content/section/blog_item.php


Open these files using a text editor:

Nearly at the bottom of these files you should be seeing something like:

<a href="<?php echo $this->item->readmore_link; ?>" class="readon<?php echo $this->item->params->get('pageclass_sfx'); ?>">
<?php if ($this->item->readmore_register) :
echo JText::_('Register to read more...');
elseif ($readmore = $this->item->params->get('readmore')) :
echo $readmore;
else :
echo JText::sprintf('Read more...');
endif; ?></a> 

Change the line

echo JText::sprintf('Read more...'); 

into

echo JText::sprintf('Read more', $this->item->title); 

 And there you have it ... you have a nice edit without actually hacking your core code. This edit will survive a Joomla upgrade :) 

One more thing...

Do you have friends or a Facebook group who you think would find this useful? Share this with them and then let me know what they think.

Want to supercharge your website?

  Our website loads FAST ... just 1.29 seconds. We're hosted on FAST InMotion servers We want YOUR website to be fast too, so we've gotten you an exclusive deal - 47% OFF for DART Creations friends + FREE domain! Check it out NOW!

Translate

who are we?

DART Creations is run by David Attard - working in and around the web design niche for more than 12 years, we provide actionable tips for people who work with and on websites. We also run DronesBuy.net - a website for drone hobbyists

David attard

Follow us on Social

         

 

 

 

Popular Content

Joomla extensions to take your website to the NEXT level

Is your Joomla website reaching its full potential? We install many of these extensions on almost ALL of our Joomla sites - why don't you check them out our list of Joomla Extensions and see whether you can take your site to the next level?

Where are we hosted?

This site is proudly powered by FAST VPS InMotion Servers and given an insane speed thanks to MaxCDN!

Web Hosting MaxCDN - Speed up your website

 

InMotion Hosting Review - Recommended Web Hosting servers for business, Joomla, WordPress and ecommerce websites.

InMotion Hosting Review

Advertise on DART-Creations.com

DART Creations is interested in developing partnerships with mutual benefit. If you like the stuff we publish and would like to develop a relationship, we'd be happy to hear from you. Go on - drop us a line - we'd love to hear from you :-)

The Outstanding october Bundle

AWESOMENESS! Bundles of premium font + graphic packs at more than 96% OFF!  Get this bundle for just $29 - This month ONLY!

The Hungry JPEG Awesome font bundles

New! DIVI 3.0 WordPress TeMPLATE + PageBuilder - 10% OFF Limited Launch offer

You'll surely create a perfect website with Divi 3.0!

Divi 3